コード例 #1
0
def get_all(person):
    if has_permission_edit(person):
        results = PermissionDAO.get_all()
        print(format_permission_header())
        for row in results:
            print(format_permission(row))
        return True
    return False
コード例 #2
0
def get_all_for_person(person, person_id):
    if has_permission_edit(person):
        results = PermissionDAO.get_for_person(person_id)
        if results is not None:
            print(format_permission_header())
            for row in results:
                print(format_permission(row))
    else:
        print("Forbidden. You are missing necessary permissions.")
コード例 #3
0
def give_permission(person, person_to_give_permission, permission):
    if has_permission_edit(person):
        return PermissionDAO.give_permission(person_to_give_permission, permission)
    else:
        print("Forbidden. You are missing necessary permissions.")
        return False
コード例 #4
0
def has_permission_edit(person):
    return PermissionDAO.has_permission(person['id'], "EDIT_PERMISSIONS")
コード例 #5
0
def has_permission_add_hotel(person):
    return PermissionDAO.has_permission(person['id'], "ADD_HOTEL")
コード例 #6
0
def has_permission_view_hotel(person):
    return PermissionDAO.has_permission(person['id'], "VIEW_HOTEL")
コード例 #7
0
def has_permission_view_users(person):
    return PermissionDAO.has_permission(person['id'], "VIEW_USERS")
コード例 #8
0
def has_permission_add_user(person):
    return PermissionDAO.has_permission(person['id'], "ADD_USERS")