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: transitional support
Date Mon, 05 Jun 2017 22:19:20 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 ff4690b  transitional support
ff4690b is described below

commit ff4690b35c7e7a51944458d7a8c71ea8553b2e7b
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jun 5 18:18:14 2017 -0400

    transitional support
    
    Handle incubator as a project; handle others as a committee+group
---
 lib/whimsy/asf/ldap.rb | 68 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 61 insertions(+), 7 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index caa249c..24a9681 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -729,20 +729,21 @@ module ASF
     end
 
     # create an LDAP group for this project
-    def create(people)
-      people = Array(people).map(&:dn)
+    def create(owners, committers=nil)
+      owners = Array(owners).map(&:dn)
+      committers = Array(committers || owners).map(&:dn)
 
       entry = [
         ASF::Base.mod_add('objectClass', ['groupOfNames', 'top']),
         ASF::Base.mod_add('cn', name), 
-        ASF::Base.mod_add('member', people),
-        ASF::Base.mod_add('owner', people)
+        ASF::Base.mod_add('owner', owners),
+        ASF::Base.mod_add('member', committers),
       ]
 
       ASF::LDAP.add("cn=#{name},#{base}", entry)
 
-      self.owners = people
-      self.members = people
+      self.owners = owners
+      self.members = committers
     end
 
     def members=(members)
@@ -775,7 +776,7 @@ module ASF
       remove_members(people)
     end
 
-    # remove people as owners project
+    # remove people as owners of a project
     def remove_owners(people)
       @owners = nil
       removals = (Array(people) & owners).map(&:dn)
@@ -865,6 +866,59 @@ module ASF
       members.map {|uid| Person.find uid[/uid=(.*?),/,1]}
     end
 
+    # transitional methods
+    def owners
+      if name == 'incubator'
+        ASF::Project.find('incubator').owners
+      else
+        members
+      end
+    end
+
+    def committers
+      if name == 'incubator'
+        ASF::Project.find('incubator').members
+      else
+        ASF::Group.find(name).members
+      end
+    end
+
+    # remove people as owners of a project
+    def remove_owners(people)
+      if name == 'incubator'
+        ASF::Project.find('incubator').remove_owners(people)
+      else
+        remove(people)
+      end
+    end
+
+    # remove people as members of a project
+    def remove_committers(people)
+      if name == 'incubator'
+        ASF::Project.find('incubator').remove_members(people)
+      else
+        ASF::Group.find(name).remove(people)
+      end
+    end
+
+    # add people as owners of a project
+    def add_owners(people)
+      if name == 'incubator'
+        ASF::Project.find('incubator').add_owners(people)
+      else
+        add(people)
+      end
+    end
+
+    # add people as members of a project
+    def add_committers(people)
+      if name == 'incubator'
+        ASF::Project.find('incubator').add_members(people)
+      else
+        ASF::Group.find(name).add(people)
+      end
+    end
+
     def dn
       @dn ||= ASF.search_one(base, "cn=#{name}", 'dn').first.first
     end

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

Mime
View raw message