You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/04/12 02:39:56 UTC

[whimsy] branch master updated: Allow secretary and root to modify givenName

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

rubys 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  4740cbc   Allow secretary and root to modify givenName
4740cbc is described below

commit 4740cbcfdc1804ff8dcd15e6bd03b5fc767124b6
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Apr 11 22:39:34 2017 -0400

    Allow secretary and root to modify givenName
---
 www/roster/models/committer.rb            |  4 ++++
 www/roster/views/actions/fullname.json.rb | 13 ++++++++++---
 www/roster/views/person/fullname.js.rb    |  6 ++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/www/roster/models/committer.rb b/www/roster/models/committer.rb
index 6daed41..f239ed5 100644
--- a/www/roster/models/committer.rb
+++ b/www/roster/models/committer.rb
@@ -21,6 +21,10 @@ class Committer
       name[:ldap] = person.attrs['cn'].first.force_encoding('utf-8')
     end
 
+    unless person.attrs['givenName'].empty?
+      name[:given_name] = person.attrs['givenName'].first.force_encoding('utf-8')
+    end
+
     response[:name] = name
 
     response[:mail] = person.all_mail
diff --git a/www/roster/views/actions/fullname.json.rb b/www/roster/views/actions/fullname.json.rb
index 61c950f..a882e2d 100644
--- a/www/roster/views/actions/fullname.json.rb
+++ b/www/roster/views/actions/fullname.json.rb
@@ -4,13 +4,20 @@
 person = ASF::Person.find(@userid)
 
 # update LDAP
-if person.attrs['cn'] != @publicname
+if person.attrs['cn'] != @publicname || person.attrs['givenName'] != @givenname
   _ldap.update do
-    _previous person.attrs['cn']
+    _previous({
+      publicname: person.attrs['cn'], 
+      givenname: person.attrs['givenName']
+    })
 
-    if @publicname and not @dryrun
+    if not @dryrun and @publicname and person.attrs['cn'] != @publicname
       person.modify 'cn', @publicname
     end
+
+    if not @dryrun and @givenname and person.attrs['givenName'] != @givenname
+      person.modify 'givenName', @givenname
+    end
   end
 end
 
diff --git a/www/roster/views/person/fullname.js.rb b/www/roster/views/person/fullname.js.rb
index a12a9a5..354f456 100644
--- a/www/roster/views/person/fullname.js.rb
+++ b/www/roster/views/person/fullname.js.rb
@@ -27,6 +27,12 @@ class PersonName < React
                 defaultValue: name.legal_name
             end
 
+            _div do
+              _label 'given name', for: 'givenname'
+              _input.legalname! name: 'givenname', required: true,
+                defaultValue: name.given_name
+            end
+
             _button.btn.btn_primary 'submit'
           end
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].