mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 11:38:39 +02:00
lint, change permissions tests in permissions classes
This commit is contained in:
parent
ca327fc094
commit
2840ebc63d
3 changed files with 7 additions and 4 deletions
|
@ -12,6 +12,7 @@ from django.db import migrations
|
|||
from registrar.models import UserGroup
|
||||
from typing import Any
|
||||
|
||||
|
||||
# For linting: RunPython expects a function reference,
|
||||
# so let's give it one
|
||||
def create_groups(apps, schema_editor) -> Any:
|
||||
|
|
|
@ -63,9 +63,9 @@ class DomainPermission(PermissionsLoginMixin):
|
|||
"""
|
||||
|
||||
# Check if the user is permissioned...
|
||||
user_is_analyst_or_superuser = (
|
||||
self.request.user.is_staff or self.request.user.is_superuser
|
||||
)
|
||||
user_is_analyst_or_superuser = self.request.user.has_perm(
|
||||
"registrar.analyst_access_permission"
|
||||
) or self.request.user.has_perm("registrar.full_access_permission")
|
||||
|
||||
if not user_is_analyst_or_superuser:
|
||||
return False
|
||||
|
|
|
@ -33,7 +33,9 @@ class DomainPermissionView(DomainPermission, DetailView, abc.ABC):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
user = self.request.user
|
||||
context["is_analyst_or_superuser"] = user.is_staff or user.is_superuser
|
||||
context["is_analyst_or_superuser"] = user.has_perm(
|
||||
"registrar.analyst_access_permission"
|
||||
) or user.has_perm("registrar.full_access_permission")
|
||||
# Stored in a variable for the linter
|
||||
action = "analyst_action"
|
||||
action_location = "analyst_action_location"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue