From 31845ef7c5536a8040ca0b06c8c6d1288304c61e Mon Sep 17 00:00:00 2001 From: Ethan Paul Date: Thu, 27 Feb 2020 00:06:22 -0500 Subject: [PATCH] !fixup Add access_list_names property back to domain model --- keyosk/database/domain.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/keyosk/database/domain.py b/keyosk/database/domain.py index aed384f..1c29ddc 100644 --- a/keyosk/database/domain.py +++ b/keyosk/database/domain.py @@ -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})"