Add ineligible status on domain application, on user. Trigger fsm transition on domain application which triggers status ineligible on user. Edit permissions on domains and newly created application wizard perm class to block access to ineligible users. Run migrations.

This commit is contained in:
rachidatecs 2023-08-18 17:24:34 -04:00
parent 87bb71a214
commit c98392baac
No known key found for this signature in database
GPG key ID: 3CEBBFA7325E5525
9 changed files with 236 additions and 7 deletions

View file

@ -26,6 +26,7 @@ class DomainApplication(TimeStampedModel):
APPROVED = "approved"
WITHDRAWN = "withdrawn"
REJECTED = "rejected"
INELIGIBLE = "ineligible"
STATUS_CHOICES = [
(STARTED, STARTED),
(SUBMITTED, SUBMITTED),
@ -34,6 +35,7 @@ class DomainApplication(TimeStampedModel):
(APPROVED, APPROVED),
(WITHDRAWN, WITHDRAWN),
(REJECTED, REJECTED),
(INELIGIBLE, INELIGIBLE)
]
class StateTerritoryChoices(models.TextChoices):
@ -554,7 +556,7 @@ class DomainApplication(TimeStampedModel):
)
@transition(
field="status", source=[SUBMITTED, IN_REVIEW, REJECTED], target=APPROVED
field="status", source=[SUBMITTED, IN_REVIEW, REJECTED, INELIGIBLE], target=APPROVED
)
def approve(self):
"""Approve an application that has been submitted.
@ -602,6 +604,17 @@ class DomainApplication(TimeStampedModel):
"emails/status_change_rejected.txt",
"emails/status_change_rejected_subject.txt",
)
@transition(field="status", source=[IN_REVIEW, APPROVED], target=INELIGIBLE)
def reject_with_prejudice(self):
"""The applicant is a bad actor, reject with prejudice.
No email As a side effect, but we block the applicant from editing
any existing domains and from submitting new apllications"""
self.creator.block_user()
# ## Form policies ###
#