Browse Source

Inline is_superuser check

pull/333/head
Clemens Wolff 5 years ago
committed by margaretmeehan
parent
commit
e9ed5fd26c
1 changed files with 2 additions and 6 deletions
  1. 8
      app/api/permissions.py

8
app/api/permissions.py

@ -44,16 +44,12 @@ class RolePermission(ProjectMixin, BasePermission):
unsafe_methods_check = True
role_name = ''
def is_super_user(self, user):
return user.is_superuser
def has_permission(self, request, view):
is_super_user = self.is_super_user(request.user)
if is_super_user:
if request.user.is_superuser:
return True
if self.unsafe_methods_check and request.method in self.UNSAFE_METHODS:
return is_super_user
return request.user.is_superuser
project_id = self.get_project_id(request, view)
if not project_id and request.method in SAFE_METHODS:

Loading…
Cancel
Save