This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ff944374 support overlapping admin urls, if a tool is installed with 
"groups" mount point
7ff944374 is described below

commit 7ff9443742f751009b4f6bf0d33f76cb4efae868
Author: Dave Brondsema <dbronds...@slashdotmedia.com>
AuthorDate: Tue Mar 12 11:40:18 2024 -0400

    support overlapping admin urls, if a tool is installed with "groups" mount 
point
---
 Allura/allura/ext/admin/admin_main.py        | 13 ++++++++-----
 Allura/allura/tests/functional/test_admin.py |  6 ++++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/ext/admin/admin_main.py 
b/Allura/allura/ext/admin/admin_main.py
index d250a70fe..78563f2cb 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -300,11 +300,6 @@ class ProjectAdminController(BaseController):
             raise exc.HTTPNotFound(name)
         return app.admin, remainder
 
-    @without_trailing_slash
-    @expose('jinja:allura.ext.admin:templates/project_permissions.html')
-    def groups(self, **kw):
-        return dict()
-
     @expose()
     @require_post()
     @validate(W.metadata_admin, error_handler=overview)
@@ -1089,6 +1084,14 @@ class GroupsController(BaseController):
     def _check_security(self):
         require_access(c.project, 'admin')
 
+    @expose()
+    def _lookup(self, *remainder):
+        # if a forum/wiki/etc is installed at mount_point 'groups', this 
allows its tool admin pages to still work
+        # could expand this to other ProjectAdminController paths too.
+        app = c.project.app_instance('groups')
+        if app:
+            return app.admin, remainder
+
     def _index_permissions(self):
         permissions = {
             p: [] for p in c.project.permissions}
diff --git a/Allura/allura/tests/functional/test_admin.py 
b/Allura/allura/tests/functional/test_admin.py
index 485f26b9b..62d7111d8 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -999,6 +999,12 @@ class TestProjectAdmin(TestController):
         resp = self.app.post('/admin/update', params={'fediverse_address': 
'https://indieweb.social/@test'})
         assert resp.status_int == 302
 
+    @td.with_tool('test', 'Wiki', 'groups')
+    def test_overlapping_url_paths(self):
+        # the wiki installed at "groups" overlaps its admin pages with normal 
/admin/groups but is still usable
+        r = self.app.get('/p/test/admin/groups/edit_label')
+        r.mustcontain('<form method="post" 
action="/p/test/admin/groups/update_label">')
+
 
 class TestExport(TestController):
 

Reply via email to