This commit is contained in:
laodaming 2023-11-15 18:42:49 +08:00
parent 0fee793931
commit 41e446e3a5

View File

@ -54,7 +54,7 @@ func (l *Ldap) Search(DN, filter string, attr []string, controls []ldap.Control)
return l.conn.Search(searchRequest)
}
// AddUserToGroup 添加用户到分组(暂时不用这种方式除非组里面objectClass设置了groupOfNames)
// AddUserToGroup 添加用户到分组
func (l *Ldap) AddUserToGroup(groupDN, userDN string) error {
//判断dn是否以ou开头
if groupDN[:3] == "ou=" {
@ -65,7 +65,7 @@ func (l *Ldap) AddUserToGroup(groupDN, userDN string) error {
return l.conn.Modify(modify)
}
// DelUserFromGroup 将用户从分组删除(暂时不用这种方式除非组里面objectClass设置了groupOfNames)
// DelUserFromGroup 将用户从分组删除
func (l *Ldap) RemoveUserFromGroup(groupDN, userDN string) error {
modify := ldap.NewModifyRequest(groupDN, nil)
modify.Delete("uniqueMember", []string{userDN})