Skip to content

Commit

Permalink
add support of group/groupOfNames/groupOfUniqueNames (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaas authored and Kostya Lepa committed Nov 1, 2019
1 parent d8c1f47 commit 949b123
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ require (
gopkg.in/asn1-ber.v1 v1.0.0-20170511165959-379148ca0225 // indirect
gopkg.in/ldap.v2 v2.5.1
)

go 1.13
5 changes: 4 additions & 1 deletion internal/ldapclient/ldapclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ func (c *ldapConn) SearchUser(user string, attrs ...string) ([]map[string]interf
}

func (c *ldapConn) SearchUserRoles(user string, attrs ...string) ([]map[string]interface{}, error) {
query := fmt.Sprintf("(&(objectClass=group)(member=%s))", user)
query := fmt.Sprintf("(|"+
"(&(|(objectClass=group)(objectClass=groupOfNames))(member=%[1]s))"+
"(&(objectClass=groupOfUniqueNames)(uniqueMember=%[1]s))"+
")", user)
return c.searchEntries(c.RoleBaseDN, query, attrs)
}

Expand Down

0 comments on commit 949b123

Please sign in to comment.