1
0
mirror of https://github.com/enpaul/keyosk.git synced 2024-11-05 06:07:06 +00:00

!fixup Add access_list_names property back to domain model

This commit is contained in:
Ethan Paul 2020-02-27 00:06:22 -05:00
parent d6265c4797
commit 31845ef7c5

View File

@ -53,6 +53,11 @@ class Domain(KeyoskBaseModel):
_lifespan_access = peewee.IntegerField(null=False)
_lifespan_refresh = peewee.IntegerField(null=False)
@property
def access_list_names(self) -> List[str]:
"""Return the list of access list names"""
return [item.name for item in self.access_lists]
@property
def lifespan_access(self) -> datetime.timedelta:
"""Return the access lifespan as a timedelta"""
@ -90,13 +95,13 @@ class Domain(KeyoskBaseModel):
"enable_refresh",
"lifespan_access",
"lifespan_refresh",
"access_lists",
"access_list_names",
"permissions",
]
@staticmethod
def foreign_backref() -> List[str]:
return ["access_lists", "permissions"]
return ["permissions"]
def __str__(self) -> str:
return f"Domain '{self.name}' ({self.uuid})"