mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-03 09:43:33 +02:00
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:
parent
87bb71a214
commit
c98392baac
9 changed files with 236 additions and 7 deletions
|
@ -16,6 +16,20 @@ class User(AbstractUser):
|
|||
A custom user model that performs identically to the default user model
|
||||
but can be customized later.
|
||||
"""
|
||||
|
||||
# #### Constants for choice fields ####
|
||||
INELIGIBLE = 'ineligible'
|
||||
STATUS_CHOICES = (
|
||||
(INELIGIBLE, INELIGIBLE),
|
||||
)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=10,
|
||||
choices=STATUS_CHOICES,
|
||||
default=None, # Set the default value to None
|
||||
null=True, # Allow the field to be null
|
||||
blank=True, # Allow the field to be blank
|
||||
)
|
||||
|
||||
domains = models.ManyToManyField(
|
||||
"registrar.Domain",
|
||||
|
@ -38,6 +52,19 @@ class User(AbstractUser):
|
|||
return self.email
|
||||
else:
|
||||
return self.username
|
||||
|
||||
def block_user(self):
|
||||
self.status = "ineligible"
|
||||
self.save()
|
||||
|
||||
def unblock_user(self):
|
||||
self.status = None
|
||||
self.save()
|
||||
|
||||
def is_blocked(self):
|
||||
if self.status == "ineligible":
|
||||
return True
|
||||
return False
|
||||
|
||||
def first_login(self):
|
||||
"""Callback when the user is authenticated for the very first time.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue