Skip to content

Commit 73bb6d2

Browse files
committed
middleware: Only ignore /admin if superuser
The superuser should always be able to access /admin, however they should be able to create rules blocking /admin.
1 parent ba77131 commit 73bb6d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api_permission/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def process_request(self, request):
3535
return self._return_403_res(msg)
3636

3737
logger.debug(f"header_token is:{header_token} user: {user}, method: {method}, path: {path}")
38-
if not path.startswith('/admin/'):
38+
if not path.startswith('/admin/') or not user.is_superuser:
3939
if path.startswith(API_PREFIX):
4040
if not self._has_permission(path, user, method):
4141
res = JsonResponse({

0 commit comments

Comments
 (0)