0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-27 23:01:43 -05:00

ldap: prune unused code

We don't use this method. Remove it so CI/CD coverage is better
reported.
This commit is contained in:
Ramkumar Chinchani 2020-03-30 23:10:49 -07:00
parent 9ecb5cedf3
commit 9fa185f2bb

View file

@ -216,32 +216,3 @@ func (lc *LDAPClient) Authenticate(username, password string) (bool, map[string]
return true, user, nil
}
// GetGroupsOfUser returns the group for a user.
func (lc *LDAPClient) GetGroupsOfUser(username string) ([]string, error) {
err := lc.Connect()
if err != nil {
return nil, err
}
searchRequest := ldap.NewSearchRequest(
lc.Base,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf(lc.GroupFilter, username),
[]string{"cn"}, // can it be something else than "cn"?
nil,
)
sr, err := lc.Conn.Search(searchRequest)
if err != nil {
return nil, err
}
groups := []string{}
for _, entry := range sr.Entries {
groups = append(groups, entry.GetAttributeValue("cn"))
}
return groups, nil
}