more checking when creating ldap group
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-11 18:00:41 +11:00
parent b65d1ef52e
commit 62606cbee5
2 changed files with 36 additions and 7 deletions

View File

@@ -26,6 +26,19 @@ func GroupGetByName(groupname string) (Group, error) {
return g, nil
}
// GroupGetByName queries the database for a group with the specified LDAP distinguishedName
func GroupGetByLdapDn(ldapDn string) (Group, error) {
var g Group
// Query database for matching group object
err := db.QueryRowx("SELECT * FROM groups WHERE LdapGroup = 1 AND LdapDn = ?", ldapDn).StructScan(&g)
if err != nil {
return g, errors.New("group not found")
}
return g, nil
}
// GroupList returns a list of all groups in database
func GroupList() ([]Group, error) {
var results []Group