Merge pull request #1974 from cisagov/es/1828-analyst-del-domain-mgr

1828: Allow analysts to delete domain managers of domains they do not manage
This commit is contained in:
Erin Song 2024-04-02 08:54:56 -07:00 committed by GitHub
commit e4a8773e56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -307,7 +307,12 @@ class UserDeleteDomainRolePermission(PermissionsLoginMixin):
domain=domain_pk,
domain__permissions__user=self.request.user,
).exists()
if not has_delete_permission:
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 (has_delete_permission or user_is_analyst_or_superuser):
return False
# Check if more than one manager exists on the domain.