Esempio n. 1
0
def role_has_permission(role, permission):
    if role is None:
        return False
    if not Roles.has_value(role):
        raise RoleDoesNotExistError('Role {} does not exist'.format(role))
    roles = get_roles_with_permissions()
    permissions = roles.get(role)
    return permission in permissions
Esempio n. 2
0
def role_as_string(id):
    return Roles(id).name