From e9ed5fd26ce5902ae719f402255f4d55b3caf9cf Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Sun, 11 Aug 2019 13:45:40 -0400 Subject: [PATCH] Inline is_superuser check --- app/api/permissions.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/api/permissions.py b/app/api/permissions.py index fb469e63..1f03525c 100644 --- a/app/api/permissions.py +++ b/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: