fruitbasket/modules/ldap/0004-make-givenName-optional.patch

35 lines
1.3 KiB
Diff

diff --git a/internal/core/user.go b/internal/core/user.go
index e74ccfe..ce03eeb 100644
--- a/internal/core/user.go
+++ b/internal/core/user.go
@@ -64,7 +64,6 @@ func (u User) RenderToLDAP(suffix string, allGroups map[string]Group) LDAPObject
"uid": {u.LoginName},
"cn": {u.FullName()},
"sn": {u.FamilyName},
- "givenName": {u.GivenName},
"userPassword": {u.PasswordHash},
"isMemberOf": memberOfGroupDNames,
"objectClass": {"portunusPerson", "inetOrgPerson", "organizationalPerson", "person", "top"},
@@ -74,6 +73,9 @@ func (u User) RenderToLDAP(suffix string, allGroups map[string]Group) LDAPObject
if u.EMailAddress != "" {
obj.Attributes["mail"] = []string{u.EMailAddress}
}
+ if u.GivenName != "" {
+ obj.Attributes["givenName"] = []string{u.GivenName}
+ }
if len(u.SSHPublicKeys) > 0 {
obj.Attributes["sshPublicKey"] = u.SSHPublicKeys
}
diff --git a/internal/frontend/users.go b/internal/frontend/users.go
index 225c5b3..1a961ca 100644
--- a/internal/frontend/users.go
+++ b/internal/frontend/users.go
@@ -168,7 +168,6 @@ func buildUserMasterdataFieldset(e core.Engine, u *core.User, state *h.FormState
Name: "given_name",
Label: "Given name",
Rules: []h.ValidationRule{
- core.MustNotBeEmpty,
core.MustNotHaveSurroundingSpaces,
},
},