lint, clean up tests, clean up user displays in admin (remove is_staff and is_superuser and replace with group)

This commit is contained in:
Rachid Mrad 2023-09-29 16:54:29 -04:00
parent 8db5219986
commit 11c0186b09
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
2 changed files with 12 additions and 13 deletions

View file

@ -138,8 +138,8 @@ class MyUserAdmin(BaseUserAdmin):
"first_group",
"status",
)
# First group (which should by theory be the only group)
# First group (which should in theory be the ONLY group)
def first_group(self, obj):
return f"{obj.groups.first()}"
@ -195,8 +195,6 @@ class MyUserAdmin(BaseUserAdmin):
"email",
"Permissions",
"is_active",
"is_staff",
"is_superuser",
"groups",
"Important dates",
"last_login",
@ -217,8 +215,7 @@ class MyUserAdmin(BaseUserAdmin):
"email",
"first_name",
"last_name",
"is_staff",
"is_superuser",
"first_group",
"status",
)
@ -840,7 +837,9 @@ class DomainAdmin(ListHeaderAdmin):
# Fixes a bug wherein users which are only is_staff
# can access 'change' when GET,
# but cannot access this page when it is a request of type POST.
if request.user.is_staff:
if request.user.has_perm(
"registrar.full_access_permission"
) or request.user.has_perm("registrar.analyst_access_permission"):
return True
return super().has_change_permission(request, obj)