whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: member may already exist
Date Sun, 02 Apr 2017 13:29:02 GMT
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  15cf17e   member may already exist
15cf17e is described below

commit 15cf17e71f483bbe91c5aebf1a028816b15d0afe
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sun Apr 2 09:28:50 2017 -0400

    member may already exist
---
 www/secmail/views/actions/memapp.json.rb | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/www/secmail/views/actions/memapp.json.rb b/www/secmail/views/actions/memapp.json.rb
index 184d885..7415625 100644
--- a/www/secmail/views/actions/memapp.json.rb
+++ b/www/secmail/views/actions/memapp.json.rb
@@ -120,19 +120,24 @@ task "update cn=member,ou=groups,dc=apache,dc=org in LDAP" do
 
   complete do
     ldap = ASF.init_ldap(true)
-    ldap.bind("uid=#{env.user.untaint},ou=people,dc=apache,dc=org",
-      env.password.untaint)
+    if ASF::Group.find('member').include? ASF::Person.find(@availid)
+      _transcript ["#@availid already in group member"]
+    else
+      ldap.bind("uid=#{env.user.untaint},ou=people,dc=apache,dc=org",
+        env.password.untaint)
 
-    ldap.modify "cn=member,ou=groups,dc=apache,dc=org",
-      [LDAP.mod(LDAP::LDAP_MOD_ADD, 'memberUid', [@availid])]
+      ldap.modify "cn=member,ou=groups,dc=apache,dc=org",
+        [LDAP.mod(LDAP::LDAP_MOD_ADD, 'memberUid', [@availid])]
 
-    if ldap.err == 0
-      _transcript ["LDAP mod add: #{ldap.err2string(ldap.err)} (#{ldap.err})"]
-    else
-      _backtrace ["LDAP mod add: #{ldap.err2string(ldap.err)} (#{ldap.err})"]
-    end
+      log = ["LDAP mod add: #{ldap.err2string(ldap.err)} (#{ldap.err})"]
+      if ldap.err == 0
+        _transcript log
+      else
+        _backtrace log
+      end
 
-    ldap.unbind
+      ldap.unbind
+    end
   end
 end
 

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

Mime
View raw message