From ff84d7143f17a246c0222bf94e0bb10528d3255c Mon Sep 17 00:00:00 2001 From: Le Bao Hiep Date: Sat, 23 Sep 2023 09:39:53 +0700 Subject: [PATCH] Fix `can_edit_organization` to check `edit_all_organization` permission --- judge/views/organization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/judge/views/organization.py b/judge/views/organization.py index a0f490b8e..90af785ce 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -62,7 +62,7 @@ def can_edit_organization(self, org=None): org = self.object if not self.request.user.is_authenticated: return False - return org.is_admin(self.request.profile) + return org.is_admin(self.request.profile) or self.request.user.has_perm('judge.edit_all_organization') class BaseOrganizationListView(OrganizationMixin, ListView): @@ -451,7 +451,7 @@ def can_edit_organization(self, org=None): org = self.organization if not self.request.user.is_authenticated: return False - return org.is_admin(self.request.profile) + return org.is_admin(self.request.profile) or self.request.user.has_perm('judge.edit_all_organization') class CustomAdminOrganizationMixin(CustomOrganizationMixin):