Merge pull request #499 from dod-ccpo/workspace-member-buttons-#162641480
Workspace member buttons #162641480
This commit is contained in:
@@ -146,7 +146,10 @@ class Workspaces(object):
|
||||
|
||||
@classmethod
|
||||
def can_revoke_access_for(cls, workspace, workspace_role):
|
||||
return workspace_role.user != workspace.owner
|
||||
return (
|
||||
workspace_role.user != workspace.owner
|
||||
and workspace_role.status == WorkspaceRoleStatus.ACTIVE
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def revoke_access(cls, user, workspace_id, workspace_role_id):
|
||||
|
@@ -77,7 +77,18 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
|
||||
|
||||
@property
|
||||
def is_expired(self):
|
||||
return datetime.datetime.now(self.expiration_time.tzinfo) > self.expiration_time
|
||||
return (
|
||||
datetime.datetime.now(self.expiration_time.tzinfo) > self.expiration_time
|
||||
and not self.status == Status.ACCEPTED
|
||||
)
|
||||
|
||||
@property
|
||||
def is_inactive(self):
|
||||
return self.is_expired or self.status in [
|
||||
Status.REJECTED_WRONG_USER,
|
||||
Status.REJECTED_EXPIRED,
|
||||
Status.REVOKED,
|
||||
]
|
||||
|
||||
@property
|
||||
def workspace(self):
|
||||
|
@@ -117,6 +117,10 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
|
||||
def role_displayname(self):
|
||||
return self.role.display_name
|
||||
|
||||
@property
|
||||
def is_active(self):
|
||||
return self.status == Status.ACTIVE
|
||||
|
||||
@property
|
||||
def num_environment_roles(self):
|
||||
return (
|
||||
@@ -147,8 +151,8 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
|
||||
|
||||
@property
|
||||
def can_resend_invitation(self):
|
||||
return self.latest_invitation and (
|
||||
self.latest_invitation.is_rejected or self.latest_invitation.is_expired
|
||||
return not self.is_active and (
|
||||
self.latest_invitation and self.latest_invitation.is_inactive
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user