- config 重写:删 user-ou/inactive-ou/group-root-* / group-object-class / group-member-attr / initial-password;新增 lldap 写通道 + webhook + confirm-base-url + 两套 schedule + guard - ldaplib 收拢为只读:属性常量/DN 归入 attrs.go;删 ops.go 写路径与 internal/password - config.example.yml 重写成 LLDAP 形态 - 组命名修订(呼应 AGENTS.md 约束12):用部门稳定索引 cn=<dept_id> 做组身份, mirror_departments 增 group_id 列并跨快照保留,可读中文名只走 DB 展示
29 lines
1.2 KiB
Go
29 lines
1.2 KiB
Go
package mapping
|
|
|
|
// 部门组的命名与 DN 构造。
|
|
//
|
|
// LLDAP 组不嵌套(组里只能有用户),且组身份必须稳定:部门改名不能引起组
|
|
// displayName/CN 变化,否则 Authelia 与下游对组的引用会连锁失效。因此组名用
|
|
// 部门稳定索引(open_department_id)派生,而不是拼音——拼音对可读但多义、且
|
|
// 改名即换身份。可读的部门中文名不进入组名,存放在数据库的 name 列与用户的
|
|
// business_category 里供展示(见 AGENTS.md 约束 12)。
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"idsync/internal/ldaplib"
|
|
)
|
|
|
|
// GroupRootDN 返回部门组根 OU 的完整 DN。LLDAP 分组固定挂在 ou=groups 下。
|
|
func GroupRootDN(baseDN string) string {
|
|
return "ou=groups," + strings.TrimSpace(baseDN)
|
|
}
|
|
|
|
// DeptGroupDN 由部门稳定索引派生出该部门组的完整 DN。
|
|
//
|
|
// 形如 cn=<dept_id>,ou=groups,<base>。open_department_id 在飞书租户内全局唯一、
|
|
// 且部门改名/挪动不变,因此组身份稳定;部门树的父子/层级关系只维护在 SQLite 的
|
|
// mirror_departments.parent_id,不从组名解码(见 AGENTS.md 约束 12)。
|
|
func DeptGroupDN(deptID, baseDN string) string {
|
|
return ldaplib.GroupDN(deptID, GroupRootDN(baseDN))
|
|
} |