format workspace role changes
This commit is contained in:
parent
463e983a38
commit
15a7297b92
@ -2,7 +2,9 @@ from sqlalchemy.orm.exc import NoResultFound
|
|||||||
|
|
||||||
from atst.database import db
|
from atst.database import db
|
||||||
from atst.models.workspace_role import (
|
from atst.models.workspace_role import (
|
||||||
WorkspaceRole, Status as WorkspaceRoleStatus, MEMBER_STATUSES
|
WorkspaceRole,
|
||||||
|
Status as WorkspaceRoleStatus,
|
||||||
|
MEMBER_STATUSES,
|
||||||
)
|
)
|
||||||
from atst.models.user import User
|
from atst.models.user import User
|
||||||
|
|
||||||
@ -12,8 +14,7 @@ from .exceptions import NotFoundError
|
|||||||
|
|
||||||
|
|
||||||
MEMBER_STATUS_CHOICES = [
|
MEMBER_STATUS_CHOICES = [
|
||||||
dict(name=key, display_name=value)
|
dict(name=key, display_name=value) for key, value in MEMBER_STATUSES.items()
|
||||||
for key, value in MEMBER_STATUSES.items()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,21 +82,21 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
|
|||||||
@property
|
@property
|
||||||
def display_status(self):
|
def display_status(self):
|
||||||
if self.status == Status.ACTIVE:
|
if self.status == Status.ACTIVE:
|
||||||
return MEMBER_STATUSES['active']
|
return MEMBER_STATUSES["active"]
|
||||||
elif self.latest_invitation:
|
elif self.latest_invitation:
|
||||||
if self.latest_invitation.is_revoked:
|
if self.latest_invitation.is_revoked:
|
||||||
return MEMBER_STATUSES['revoked']
|
return MEMBER_STATUSES["revoked"]
|
||||||
elif self.latest_invitation.is_rejected_wrong_user:
|
elif self.latest_invitation.is_rejected_wrong_user:
|
||||||
return MEMBER_STATUSES['error']
|
return MEMBER_STATUSES["error"]
|
||||||
elif (
|
elif (
|
||||||
self.latest_invitation.is_rejected_expired
|
self.latest_invitation.is_rejected_expired
|
||||||
or self.latest_invitation.is_expired
|
or self.latest_invitation.is_expired
|
||||||
):
|
):
|
||||||
return MEMBER_STATUSES['expired']
|
return MEMBER_STATUSES["expired"]
|
||||||
else:
|
else:
|
||||||
return MEMBER_STATUSES['pending']
|
return MEMBER_STATUSES["pending"]
|
||||||
else:
|
else:
|
||||||
return MEMBER_STATUSES['unknown']
|
return MEMBER_STATUSES["unknown"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_dod_id_error(self):
|
def has_dod_id_error(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user