Create Projects.for_user and Environments.for_user

This commit is contained in:
richard-dds
2018-09-10 13:42:24 -04:00
parent 39a1a5508c
commit eb99e72659
4 changed files with 85 additions and 3 deletions

View File

@@ -22,7 +22,8 @@ class Workspace(Base, TimestampsMixin):
def _is_workspace_owner(workspace_role):
return workspace_role.role.name == "owner"
return first_or_none(_is_workspace_owner, self.roles)
owner = first_or_none(_is_workspace_owner, self.roles)
return owner.user if owner else None
@property
def users(self):