From e3f59e3a24f039b99774d3c5af0febe4b8ebb7a2 Mon Sep 17 00:00:00 2001 From: DevMiner Date: Fri, 6 Oct 2023 14:49:56 +0200 Subject: [PATCH] fix: adding/removing users to/from groups --- users.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/users.go b/users.go index 8b924fa..1556135 100644 --- a/users.go +++ b/users.go @@ -147,13 +147,13 @@ func (l *LDAP) AddUserToGroup(dn, groupDN string) error { defer c.Close() return c.Modify(&ldap.ModifyRequest{ - DN: dn, + DN: groupDN, Changes: []ldap.Change{ { Operation: ldap.AddAttribute, Modification: ldap.PartialAttribute{ - Type: "memberOf", - Vals: []string{groupDN}, + Type: "member", + Vals: []string{dn}, }, }, }, @@ -168,13 +168,13 @@ func (l *LDAP) RemoveUserFromGroup(dn, groupDN string) error { defer c.Close() return c.Modify(&ldap.ModifyRequest{ - DN: dn, + DN: groupDN, Changes: []ldap.Change{ { Operation: ldap.DeleteAttribute, Modification: ldap.PartialAttribute{ - Type: "memberOf", - Vals: []string{groupDN}, + Type: "member", + Vals: []string{dn}, }, }, },