cleanup some code

This commit is contained in:
Rachid Mrad 2023-10-03 18:54:55 -04:00
parent 08514a75dc
commit 09303401ed
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
3 changed files with 12 additions and 8 deletions

View file

@ -7,6 +7,8 @@ Permissions on these roles are set through groups:
groups and the methods to create them are defined in
our `user_group` model and run in a migration.
For more details, refer to the [user group model](../../src/registrar/models/user_group.py).
## Editing group permissions through code
We can edit and deploy new group permissions by:

View file

@ -193,6 +193,14 @@ class MyUserAdmin(BaseUserAdmin):
("Important dates", {"fields": ("last_login", "date_joined")}),
)
analyst_list_display = [
"email",
"first_name",
"last_name",
"group",
"status",
]
# NOT all fields are readonly for admin, otherwise we would have
# set this at the permissions level. The exception is 'status'
analyst_readonly_fields = [
@ -219,13 +227,7 @@ class MyUserAdmin(BaseUserAdmin):
return super().get_list_display(request)
# Customize the list display for analysts
return (
"email",
"first_name",
"last_name",
"group",
"status",
)
return self.analyst_list_display
def get_fieldsets(self, request, obj=None):
if request.user.has_perm("registrar.full_access_permission"):

View file

@ -31,7 +31,7 @@ class TestGroups(TestCase):
UserGroup.objects.filter(name="full_access_group"), [full_access_group]
)
# Test permissions for cisa_analysts)group
# Test permissions for cisa_analysts_group
# Define the expected permission codenames
expected_permissions = [
"view_logentry",