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

kentontaylor 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 05f0a5052 [#8450] include project name in tools API
05f0a5052 is described below

commit 05f0a50524253b7d6bd6e74c71679981a4bf5b57
Author: Dave Brondsema <[email protected]>
AuthorDate: Tue Aug 9 14:55:01 2022 -0400

    [#8450] include project name in tools API
---
 Allura/allura/controllers/auth.py             | 6 +++++-
 Allura/allura/tests/functional/test_auth.py   | 2 ++
 Allura/docs/api-rest/examples/auth-tools.json | 2 ++
 Allura/docs/api-rest/schemas/auth-tools.json  | 4 ++++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/controllers/auth.py 
b/Allura/allura/controllers/auth.py
index e5154f05a..5086701d8 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -565,7 +565,11 @@ class AuthRestController:
                     apps.append(p.app_instance(ac))
 
         return {
-            'tools': apps,  # TG automatically runs their __json__ methods
+            'tools': [
+                dict(app.__json__(),
+                     project_name=app.project.name,
+                     )
+                for app in apps]
         }
 
 
diff --git a/Allura/allura/tests/functional/test_auth.py 
b/Allura/allura/tests/functional/test_auth.py
index 7766ece84..c6b8fae11 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1161,6 +1161,7 @@ class TestAuthRest(TestRestApiBase):
                     'mount_label': 'Wiki',
                     'mount_point': 'wiki',
                     'name': 'wiki',
+                    'project_name': 'Home Project for Adobe',
                     'url': 'http://localhost/adobe/wiki/',
                     'api_url': 'http://localhost/rest/adobe/wiki/',
                 },
@@ -1168,6 +1169,7 @@ class TestAuthRest(TestRestApiBase):
                     'mount_label': 'Documentation',
                     'mount_point': 'docs',
                     'name': 'wiki',
+                    'project_name': 'Test Project',
                     'url': 'http://localhost/p/test/docs/',
                     'api_url': 'http://localhost/rest/p/test/docs/',
                 },
diff --git a/Allura/docs/api-rest/examples/auth-tools.json 
b/Allura/docs/api-rest/examples/auth-tools.json
index cdd569fcf..6bbc70418 100755
--- a/Allura/docs/api-rest/examples/auth-tools.json
+++ b/Allura/docs/api-rest/examples/auth-tools.json
@@ -6,6 +6,7 @@
       "mount_label": "Code",
       "mount_point": "code",
       "name": "git",
+      "project_name": "Test",
       "clone_url_https_anon": 
"https://forge-allura.apache.org/git/p/test/code/";,
       "clone_url_ro": "git://forge-allura.apache.org/git/p/test/code"
     },
@@ -15,6 +16,7 @@
       "mount_label": "Widgets - Fork",
       "mount_point": "widgets-fork",
       "name": "git",
+      "project_name": "someuser",
       "clone_url_https_anon": 
"https://forge-allura.apache.org/git/u/someuser/widgets-fork";,
       "clone_url_ro": 
"git://forge-allura.apache.org/git/u/someuser/widgets-fork"
     }
diff --git a/Allura/docs/api-rest/schemas/auth-tools.json 
b/Allura/docs/api-rest/schemas/auth-tools.json
index 5de2ae579..cb649f8d7 100755
--- a/Allura/docs/api-rest/schemas/auth-tools.json
+++ b/Allura/docs/api-rest/schemas/auth-tools.json
@@ -28,6 +28,10 @@
                         "type": "string",
                         "id": "name"
                     },
+                    "project_name": {
+                        "type": "string",
+                        "id": "name"
+                    },
                     "clone_url_https_anon": {
                         "type": "string",
                         "id": "clone_url_https_anon"

Reply via email to