[Patchew-devel] [PATCH v2 1/2] Revert "unify permissions for project properties"

Fam Zheng famz at redhat.com
Wed Mar 28 01:50:07 UTC 2018


This reverts commit d023d5e60a0a15f6f81835f85c9233a96a87ef00.

The commit made project properties invisible to non-priviledged users
including importers, who need the information for doing project updates.

Signed-off-by: Fam Zheng <famz at redhat.com>
---
 api/views.py | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/api/views.py b/api/views.py
index 2d84be8..c27cd5a 100644
--- a/api/views.py
+++ b/api/views.py
@@ -73,22 +73,21 @@ class VersionView(APIView):
     def handle(self, request):
         return settings.VERSION
 
+def prepare_project(p):
+    ret = {
+        "name": p.name,
+        "mailing_list": p.mailing_list,
+        "url": p.url,
+        "git": p.git,
+        "description": p.description,
+        "properties": p.get_properties(),
+    }
+    return ret
+
 class ListProjectView(APIView):
     name = "get-projects"
 
     def handle(self, request, name=None):
-        def prepare_project(p):
-            ret = {
-                "name": p.name,
-                "mailing_list": p.mailing_list,
-                "url": p.url,
-                "git": p.git,
-                "description": p.description,
-            }
-            if p.maintained_by(request.user):
-                ret["properties"] = p.get_properties()
-            return ret
-
         r = [prepare_project(x) for x in Project.objects.all() \
                 if name == None or name == x.name]
         return r
@@ -106,7 +105,7 @@ class AddProjectView(APILoginRequiredView):
                     description=description)
         p.save()
 
-class GetProjectPropertiesView(APIView):
+class GetProjectPropertiesView(APILoginRequiredView):
     name = "get-project-properties"
 
     def handle(self, request, project):
-- 
2.14.3




More information about the Patchew-devel mailing list