improved error message
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-24 10:56:38 +10:00
parent 0d911a715c
commit 46ca98a0ce

View File

@@ -5,7 +5,6 @@ import (
"crypto/x509" "crypto/x509"
"encoding/json" "encoding/json"
"encoding/pem" "encoding/pem"
"errors"
"flag" "flag"
"fmt" "fmt"
"os" "os"
@@ -85,7 +84,7 @@ func GetGroupsOfUser(username string, baseDN string, conn *ldap.Conn) ([]string,
} }
if len(sr.Entries) != 1 { if len(sr.Entries) != 1 {
return nil, errors.New("user does not exist") return nil, fmt.Errorf("user '%s' does not exist", samAccountName)
} }
userdn := sr.Entries[0].DN userdn := sr.Entries[0].DN