mirror of
https://github.com/solero/houdini.git
synced 2024-12-23 05:53:38 +00:00
14 lines
553 B
Python
14 lines
553 B
Python
from houdini.handlers import check
|
|
|
|
|
|
def has(permission_name, check_above=True):
|
|
def check_permission(_, p):
|
|
def check_permission_recursive(permissions, permission):
|
|
if permission in permissions:
|
|
return permissions[permission].enabled
|
|
if '.' in permission and check_above:
|
|
check_permission_recursive(permissions, '.'.join(permission.split('.')[:-1]))
|
|
return False
|
|
return check_permission_recursive(p.permissions, permission_name)
|
|
return check(check_permission)
|