Merge pull request #64 from fsr/portunus-givenname

patch portunus to make givenname optional
This commit is contained in:
Rouven Seifert 2023-09-15 20:00:12 +02:00 committed by GitHub
commit 5f99060d2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -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,
},
},

View file

@ -60,6 +60,7 @@ in
./0001-update-user-validation-regex.patch ./0001-update-user-validation-regex.patch
./0002-both-ldap-and-ldaps.patch ./0002-both-ldap-and-ldaps.patch
./0003-gecos-ascii-escape.patch ./0003-gecos-ascii-escape.patch
./0004-make-givenName-optional.patch
]; ];
}); });