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 0671ea5 server side of modifying hudson-jobadmin
0671ea5 is described below
commit 0671ea53128bed115155fabebde0b4e4dc33457d
Author: Sam Ruby <[email protected]>
AuthorDate: Tue Jul 4 12:19:03 2017 -0400
server side of modifying hudson-jobadmin
---
lib/whimsy/asf/ldap.rb | 18 ++++++++++++++++++
www/roster/views/actions/appgroup.json.rb | 20 ++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 3385443..ee0a202 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -1172,6 +1172,24 @@ module ASF
def self.list(filter='cn=*')
ASF.search_subtree(base, filter, 'cn').flatten.map {|cn| find(cn)}
end
+
+ # remove people from an application group.
+ def remove(people)
+ @members = nil
+ people = (Array(people) & members).map(&:dn)
+ ASF::LDAP.modify(self.dn, [ASF::Base.mod_delete('member', people)])
+ ensure
+ @members = nil
+ end
+
+ # add people to an application group.
+ def add(people)
+ @members = nil
+ people = (Array(people) - members).map(&:dn)
+ ASF::LDAP.modify(self.dn, [ASF::Base.mod_add('member', people)])
+ ensure
+ @members = nil
+ end
end
# <tt>ou=auth</tt> subtree of <tt>ou=groups,dc=apache,dc=org</tt>, used for
diff --git a/www/roster/views/actions/appgroup.json.rb
b/www/roster/views/actions/appgroup.json.rb
new file mode 100644
index 0000000..7a523bc
--- /dev/null
+++ b/www/roster/views/actions/appgroup.json.rb
@@ -0,0 +1,20 @@
+#
+# Add or remove a person from an application group in LDAP
+#
+
+if env.password
+ person = ASF::Person.find(@id)
+ group = ASF::Approup.find(@group)
+
+ # update LDAP
+ ASF::LDAP.bind(env.user, env.password) do
+ if @action == 'add'
+ group.add(person)
+ elsif @action == 'remove'
+ group.remove(person)
+ end
+ end
+end
+
+# return updated committee info to the client
+Group.serialize(@group)
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].