mirror of
https://github.com/enpaul/keyosk.git
synced 2024-11-24 23:47:49 +00:00
Fix hacked permission and access list string names
Update domain access list and domain permission models to be dict-castable Update domain model to specify dict casting for access list and permission backrefs properly Remove unnecessary permission_names and access_list_names properties
This commit is contained in:
parent
85a53d061a
commit
ac893d9707
@ -53,16 +53,6 @@ class Domain(KeyoskBaseModel):
|
|||||||
lifespan_access = peewee.IntegerField(null=False)
|
lifespan_access = peewee.IntegerField(null=False)
|
||||||
lifespan_refresh = peewee.IntegerField(null=False)
|
lifespan_refresh = peewee.IntegerField(null=False)
|
||||||
|
|
||||||
@property
|
|
||||||
def access_list_names(self) -> List[str]:
|
|
||||||
"""Return the list of ACL items from the backref"""
|
|
||||||
return [item.name for item in self._access_lists]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def permission_names(self) -> List[str]:
|
|
||||||
"""Return the list of permission names from the backref"""
|
|
||||||
return [item.name for item in self._permissions]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dict_keys() -> List[str]:
|
def dict_keys() -> List[str]:
|
||||||
return [
|
return [
|
||||||
@ -80,10 +70,14 @@ class Domain(KeyoskBaseModel):
|
|||||||
"enable_refresh",
|
"enable_refresh",
|
||||||
"lifespan_access",
|
"lifespan_access",
|
||||||
"lifespan_refresh",
|
"lifespan_refresh",
|
||||||
"access_list_names",
|
"access_lists",
|
||||||
"permission_names",
|
"permissions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def foreign_backref() -> List[str]:
|
||||||
|
return ["access_lists", "permissions"]
|
||||||
|
|
||||||
|
|
||||||
class DomainAccessList(KeyoskBaseModel):
|
class DomainAccessList(KeyoskBaseModel):
|
||||||
"""Access list name model definition
|
"""Access list name model definition
|
||||||
@ -98,6 +92,10 @@ class DomainAccessList(KeyoskBaseModel):
|
|||||||
name = peewee.CharField(null=False)
|
name = peewee.CharField(null=False)
|
||||||
domain = peewee.ForeignKeyField(Domain, backref="access_lists")
|
domain = peewee.ForeignKeyField(Domain, backref="access_lists")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def dict_keys() -> List[str]:
|
||||||
|
return ["name"]
|
||||||
|
|
||||||
|
|
||||||
class DomainPermission(KeyoskBaseModel):
|
class DomainPermission(KeyoskBaseModel):
|
||||||
"""Permission name model definition
|
"""Permission name model definition
|
||||||
@ -114,3 +112,7 @@ class DomainPermission(KeyoskBaseModel):
|
|||||||
name = peewee.CharField(null=False)
|
name = peewee.CharField(null=False)
|
||||||
bitindex = peewee.IntegerField(null=False)
|
bitindex = peewee.IntegerField(null=False)
|
||||||
domain = peewee.ForeignKeyField(Domain, backref="permissions")
|
domain = peewee.ForeignKeyField(Domain, backref="permissions")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def dict_keys() -> List[str]:
|
||||||
|
return ["name", "bitindex"]
|
||||||
|
Loading…
Reference in New Issue
Block a user