Commit 6c2b651834355a5e677906b939449e43fb6b38e3:
to_h is relatively new; allow code to run on older Ruby versions
Branch: refs/heads/master
Author: Sebb <[email protected]>
Committer: Sebb <[email protected]>
Pusher: sebb <[email protected]>
------------------------------------------------------------
www/roster/models/group.rb | ++++++++ ---
------------------------------------------------------------
22 changes: 16 additions, 6 deletions.
------------------------------------------------------------
diff --git a/www/roster/models/group.rb b/www/roster/models/group.rb
index acc40e9..0015b1d 100644
--- a/www/roster/models/group.rb
+++ b/www/roster/models/group.rb
@@ -8,16 +8,26 @@ def self.list
groups = ASF::Group.list.map(&:id)
groups -= ASF::Committee.list.map(&:id)
groups.map! {|group| [group, "LDAP group"]}
-
# add services...
groups += ASF::Service.list.map {|service| [service, "LDAP service"]}
# add authorization (asf and pit)
- groups += ASF::Authorization.new('asf').to_h.
- map {|id, list| [id, "ASF Auth"]}
-
- groups += ASF::Authorization.new('pit').to_h.
- map {|id, list| [id, "PIT Auth"]}
+ begin
+ groups += ASF::Authorization.new('asf').to_h.
+ map {|id, list| [id, "ASF Auth"]}
+ rescue # in case to_h does not work
+ ASF::Authorization.new('asf').each do |id,list|
+ groups += [[id, "ASF Auth"]]
+ end
+ end
+ begin
+ groups += ASF::Authorization.new('pit').to_h.
+ map {|id, list| [id, "PIT Auth"]}
+ rescue # in case to_h does not work
+ ASF::Authorization.new('pit').each do |id,list|
+ groups += [[id, "PIT Auth"]]
+ end
+ end
groups.sort
end