Add missing methods for casting account model to dict

This commit is contained in:
Ethan Paul 2020-02-23 16:50:43 -05:00
parent ca183d7052
commit 733ffa6cd8
2 changed files with 11 additions and 1 deletions

View File

@ -88,4 +88,8 @@ class Account(KeyoskBaseModel):
@staticmethod
def dict_keys() -> List[str]:
return ["uuid", "created", "updated", "username", "enabled", "extras"]
return ["uuid", "created", "updated", "username", "enabled", "extras", "acls"]
@staticmethod
def foreign_backref() -> List[str]:
return ["acls"]

View File

@ -41,3 +41,9 @@ class AccountACLEntry(KeyoskBaseModel):
permission = peewee.ForeignKeyField(DomainPermission)
with_server_secret = peewee.BooleanField(null=False)
with_client_secret = peewee.BooleanField(null=False)
def __iter__(self):
yield "access_list", self.access_list.name
yield "permission", self.permission.name
yield "with_server_secret", self.with_server_secret
yield "with_client_secret", self.with_client_secret