Factoring the model user and correcting password
This commit is contained in:
parent
18ab571416
commit
0b86dc9e0e
1 changed files with 4 additions and 8 deletions
|
@ -70,15 +70,11 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
|
||||||
searchReq.BaseDN = config.GroupCanAdmin
|
searchReq.BaseDN = config.GroupCanAdmin
|
||||||
searchReq.Filter = "(member=" + user.DN + ")"
|
searchReq.Filter = "(member=" + user.DN + ")"
|
||||||
searchRes, err = ldapConn.Search(searchReq)
|
searchRes, err = ldapConn.Search(searchReq)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
log.Printf("get User : %v", err)
|
|
||||||
log.Printf("get User : %v", searchReq)
|
|
||||||
log.Printf("get User : %v", searchRes)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if len(searchRes.Entries) > 0 {
|
if len(searchRes.Entries) > 0 {
|
||||||
resUser.CanAdmin = true
|
resUser.CanAdmin = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return &resUser, nil
|
return &resUser, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue