diff --git a/keyosk/database/account.py b/keyosk/database/account.py index bd7746d..df73155 100644 --- a/keyosk/database/account.py +++ b/keyosk/database/account.py @@ -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"] diff --git a/keyosk/database/account_acl.py b/keyosk/database/account_acl.py index 6322e2f..c6220fa 100644 --- a/keyosk/database/account_acl.py +++ b/keyosk/database/account_acl.py @@ -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