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 23ecb13 WHIMSY-220 Inconsistent and confusing return from
ASF::Service.list method
23ecb13 is described below
commit 23ecb13d893051b70a3f9157fcb55bf14aaa15fc
Author: Sebb <[email protected]>
AuthorDate: Wed Dec 5 13:01:21 2018 +0000
WHIMSY-220 Inconsistent and confusing return from ASF::Service.list
method
Methods renamed to listcns() and now return only the cn
---
lib/whimsy/asf/ldap.rb | 14 +++++++++-----
www/roster/models/group.rb | 6 +++---
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 60a2fd1..88f473f 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -1440,8 +1440,8 @@ module ASF
class Service < Base
@base = 'ou=groups,ou=services,dc=apache,dc=org'
- # return a list of services, from LDAP.
- def self.list(filter='cn=*')
+ # return a list of services (cns only), from LDAP.
+ def self.listcns(filter='cn=*')
ASF.search_one(base, filter, 'cn').flatten
end
@@ -1522,8 +1522,11 @@ module ASF
class AppGroup < Service
@base = 'ou=apps,ou=groups,dc=apache,dc=org'
- def self.list(filter='cn=*')
- ASF.search_subtree(base, filter, 'cn').flatten.map {|cn| find(cn)}
+ # return a list of App groups (cns only), from LDAP.
+ def self.listcns(filter='cn=*')
+ # Note that hudson-job-admin is under ou=hudson hence need
+ # to override Service.listcns and use subtree search
+ ASF.search_subtree(base, filter, 'cn').flatten
end
# remove people from an application group.
@@ -1567,5 +1570,6 @@ if __FILE__ == $0
print ASF::Committee[w].isGuineaPig?,' '
puts ASF::Committee.isGuineaPig?(w)
end
- ASF::RoleGroup.list.map {|g| puts ASF::RoleGroup.find(g).dn}
+ ASF::RoleGroup.listcns.map {|g| puts ASF::RoleGroup.find(g).dn}
+ ASF::AppGroup.listcns.map {|g| puts ASF::AppGroup.find(g).dn}
end
diff --git a/www/roster/models/group.rb b/www/roster/models/group.rb
index 7517ed5..93e54da 100644
--- a/www/roster/models/group.rb
+++ b/www/roster/models/group.rb
@@ -10,7 +10,7 @@ class Group
groups.map! {|group| [group, "LDAP group"]}
# add services...
- groups += ASF::Service.list.map {|service| [service, "LDAP service"]}
+ groups += ASF::Service.listcns.map {|service| [service, "LDAP service"]}
# add authorization (asf and pit)
groups += ASF::Authorization.new('asf').to_h.
@@ -20,10 +20,10 @@ class Group
map {|id, list| [id, "PIT Auth"]}
# add authorization groups (LDAP)
- groups += ASF::AuthGroup.list.map {|group| [group, "LDAP Auth Group"]}
+ groups += ASF::AuthGroup.listcns.map {|group| [group, "LDAP Auth Group"]}
# add app groups
- groups += ASF::AppGroup.list.map {|app| [app.id, "LDAP app group"]}
+ groups += ASF::AppGroup.listcns.map {|app| [app, "LDAP app group"]}
groups.sort
end