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 9a8e3861 Workround for duplicated group names
9a8e3861 is described below

commit 9a8e3861dc7ead9ffccbd875fc6cbcb962fc6b2f
Author: Sebb <[email protected]>
AuthorDate: Sat Apr 15 22:30:52 2023 +0100

    Workround for duplicated group names
---
 www/roster/main.rb              | 2 +-
 www/roster/models/group.rb      | 7 +++++--
 www/roster/views/groups.html.rb | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/www/roster/main.rb b/www/roster/main.rb
index 1354b440..f089fe8d 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -319,7 +319,7 @@ end
 
 get '/group/:name' do |name|
   @auth = Auth.info(env)
-  @group = Group.serialize(name)
+  @group = Group.serialize(name, params['type'])
   pass unless @group and not @group.empty?
   _html :group
 end
diff --git a/www/roster/models/group.rb b/www/roster/models/group.rb
index c71b1e23..b4205a2b 100644
--- a/www/roster/models/group.rb
+++ b/www/roster/models/group.rb
@@ -28,13 +28,16 @@ class Group
     groups.sort
   end
 
-  def self.serialize(id)
+  # The ids 'treasurer' and 'svnadmins' currently both have two definitions
+  # treasurer: LDAP Auth Group and Pit Auth; svnadmins: LDAP Auth Group and 
LDAP service
+  # So the type is now provided as a work-round
+  def self.serialize(id, type=nil)
     response = {}
 
     type = 'LDAP group'
     group = ASF::Group.find(id)
 
-    unless group.hasLDAP?
+    unless group.hasLDAP? or (%w{treasurer svnadmins}.include? id and type !~ 
%r{Auth Group}i)
       type = 'LDAP auth group'
       group = ASF::AuthGroup.find(id)
     end
diff --git a/www/roster/views/groups.html.rb b/www/roster/views/groups.html.rb
index 0213f7ec..c8b7cb76 100644
--- a/www/roster/views/groups.html.rb
+++ b/www/roster/views/groups.html.rb
@@ -64,7 +64,7 @@ _html do
             @groups.each do |name, type|
               next if name == 'apldap'
               _tr_ do
-                _td {_a name, href: "group/#{name}"}
+                _td {_a name, href: "group/#{name}?type=#{type}"}
                 _td type
               end
             end

Reply via email to