You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/07/06 20:29:45 UTC

[whimsy] branch master updated: Allow sn to be provided to avoid parse

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new adbf212  Allow sn to be provided to avoid parse
adbf212 is described below

commit adbf212ebe315abab61f21e903ad61ed6c8519ad
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jul 6 21:29:36 2021 +0100

    Allow sn to be provided to avoid parse
---
 lib/whimsy/asf/ldap.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index b4f0676..75e7917 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -948,8 +948,8 @@ module ASF
       attrs['host'] ||= "home.apache.org"
       attrs['asf-sascore'] ||= "10"
 
-      # parse name
-      attrs = ASF::Person.ldap_name(attrs['cn']).merge(attrs)
+      # parse name if sn has not been provided (givenName is optional)
+      attrs = ASF::Person.ldap_name(attrs['cn']).merge(attrs) unless attrs['sn']
 
       # generate a password that is between 8 and 16 alphanumeric characters
       unless attrs['userPassword']