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
def role_as_string(id): return Roles(id).name