Skip to content

Commit 6f6741c

Browse files
jolheiserlafrikszeripath
committed
Apply suggestions from code review
Co-Authored-By: Lauris BH <lauris@nix.lv> Co-Authored-By: zeripath <art27@cantab.net>
1 parent 85dfd0e commit 6f6741c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

modules/auth/ldap/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ share the following fields:
112112

113113
* Group Name Filter (optional)
114114
* An LDAP filter declaring how to find valid groups in the above DN.
115-
* Example: (|(cn=gogs_users)(cn=admins))
115+
* Example: (|(cn=gitea_users)(cn=admins))
116116

117117
* User Attribute in Group (optional)
118118
* Which user LDAP attribute is listed in the group.

modules/auth/ldap/ldap.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) *SearchResul
306306

307307
var isAttributeSSHPublicKeySet = len(strings.TrimSpace(ls.AttributeSSHPublicKey)) > 0
308308

309-
attribs := []string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail, ls.UserUID}
309+
attribs := []string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail}
310+
if len(strings.TrimSpace(ls.UserUID)) > 0 {
311+
attribs = append(attribs, ls.UserUID)
312+
}
310313
if isAttributeSSHPublicKeySet {
311314
attribs = append(attribs, ls.AttributeSSHPublicKey)
312315
}

0 commit comments

Comments
 (0)