diff --git a/modules/ldap/0004-make-givenName-optional.patch b/modules/ldap/0004-make-givenName-optional.patch new file mode 100644 index 0000000..4131252 --- /dev/null +++ b/modules/ldap/0004-make-givenName-optional.patch @@ -0,0 +1,34 @@ +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, + }, + }, diff --git a/modules/ldap/default.nix b/modules/ldap/default.nix index 7766f6a..933145d 100644 --- a/modules/ldap/default.nix +++ b/modules/ldap/default.nix @@ -60,6 +60,7 @@ in ./0001-update-user-validation-regex.patch ./0002-both-ldap-and-ldaps.patch ./0003-gecos-ascii-escape.patch + ./0004-make-givenName-optional.patch ]; });