print groups
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-24 11:51:26 +10:00
parent d4811f5deb
commit de93fc3091
2 changed files with 11 additions and 7 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,3 @@
log.txt
*.pem
*.pem
authcheck

15
main.go
View File

@@ -87,13 +87,16 @@ func GetGroupsOfUser(username string, baseDN string, conn *ldap.Conn) ([]string,
if len(sr.Entries) != 1 {
return nil, fmt.Errorf("user '%s' does not exist", samAccountName)
}
} else {
//sr.PrettyPrint(2)
sr.PrettyPrint(2)
for _, entry := range sr.Entries {
//entry.PrettyPrint(2)
fmt.Println(entry.GetAttributeValue("memberOf"))
for _, entry := range sr.Entries {
//entry.PrettyPrint(2)
groups := entry.GetAttributeValues("memberOf")
for _, group := range groups {
fmt.Println(group)
}
}
}
/*