delete the deleteinvitationdelete view and added print statements to test

This commit is contained in:
asaki222 2024-11-14 15:44:46 -05:00
parent 9fc1b46828
commit 08b9de2dce
No known key found for this signature in database
GPG key ID: 2C4F802060E06EA4
2 changed files with 5 additions and 15 deletions

View file

@ -424,13 +424,16 @@ class DomainInvitationPermission(PermissionsLoginMixin):
def has_permission(self):
"""Check if this user has a role on the domain of this invitation."""
if not self.request.user.is_authenticated:
print("filter is not authenticated")
return False
print("is authenticated")
if not DomainInvitation.objects.filter(
id=self.kwargs["pk"], domain__permissions__user=self.request.user
).exists():
print("returned false in domain invitation objects filter")
return False
print("this actually returned true")
return True

View file

@ -154,20 +154,7 @@ class DomainRequestWizardPermissionView(DomainRequestWizardPermission, TemplateV
@abc.abstractmethod
def template_name(self):
raise NotImplementedError
class DomainInvitationPermissionDeleteView(DomainInvitationPermission, DeleteView, abc.ABC):
"""Abstract view for deleting a domain invitation.
This one is fairly specialized, but this is the only thing that we do
right now with domain invitations. We still have the full
`DomainInvitationPermission` class, but here we just pair it with a
DeleteView.
"""
model = DomainInvitation
object: DomainInvitation # workaround for type mismatch in DeleteView
class DomainInvitationPermissionCancelView(DomainInvitationPermission, UpdateView, abc.ABC):
"""Abstract view for cancelling a DomainInvitation."""