[Patchew-devel] [PATCH] rest: allow IsMaintainerOrReadOnly that applies to Message
Paolo Bonzini
pbonzini at redhat.com
Wed Apr 4 16:54:10 UTC 2018
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
I had to apply this for Shubham's patch to allow non-administrator
access.
api/rest.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/api/rest.py b/api/rest.py
index bb56b4b..3e0cbc3 100644
--- a/api/rest.py
+++ b/api/rest.py
@@ -41,6 +41,8 @@ class IsMaintainerOrReadOnly(permissions.BasePermission):
Allows access only to admin users or maintainers.
"""
def has_object_permission(self, request, view, obj):
+ if isinstance(obj, Message):
+ obj = obj.project
return request.method in permissions.SAFE_METHODS or \
obj.maintained_by(request.user)
--
2.16.2
More information about the Patchew-devel
mailing list