Implement givenName and SN (first and last name)

This commit is contained in:
Ben Yanke
2018-04-11 10:41:54 -05:00
parent 209309e604
commit f3d3a38761
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -132,6 +132,16 @@ func (h configHandler) Search(bindDN string, searchReq ldap.SearchRequest, conn
attrs := []*ldap.EntryAttribute{}
attrs = append(attrs, &ldap.EntryAttribute{"cn", []string{u.Name}})
attrs = append(attrs, &ldap.EntryAttribute{"uid", []string{u.Name}})
if len(u.GivenName) > 0 {
attrs = append(attrs, &ldap.EntryAttribute{"givenName", []string{u.GivenName}})
}
if len(u.SN) > 0 {
attrs = append(attrs, &ldap.EntryAttribute{"sn", []string{u.SN}})
}
attrs = append(attrs, &ldap.EntryAttribute{"ou", []string{h.getGroupName(u.PrimaryGroup)}})
attrs = append(attrs, &ldap.EntryAttribute{"uidNumber", []string{fmt.Sprintf("%d", u.UnixID)}})
+2
View File
@@ -77,6 +77,8 @@ type configUser struct {
UnixID int
Mail string
LoginShell string
GivenName string
SN string
}
type configGroup struct {
Name string