Esempio n. 1
0
def edit_requests(field, id):
    user = get_user()
    if user is None:
        return "You are not logged in", 400
    req = Request.query.filter_by(id=int(id)).first()
    if req is None:
        return "You don't have permission for this action", 400
    return (req.poster != user.id and verify_perm('edit')) or handleFormAction(
        RequestForm, field, edit_request, id)
Esempio n. 2
0
def signup(field):
    return handleFormAction(SignupForm, field, post_signup)
Esempio n. 3
0
def login(field):
    return handleFormAction(LoginForm, field, post_login)
Esempio n. 4
0
def edit_roles(id, field):
    return verify_perm('admin') or handleFormAction(RoleForm, field, edit_role,
                                                    id)
Esempio n. 5
0
def edit_users(id, field):
    return verify_perm('admin') or handleFormAction(UserForm, field, edit_user,
                                                    id)
Esempio n. 6
0
def edit_production(id, field):
    return verify_perm('admin') or handleFormAction(ProductionForm, field,
                                                    edit_production, id)
Esempio n. 7
0
def edit_clients(id, field):
    return verify_perm('admin') or handleFormAction(ClientForm, field,
                                                    edit_client, id)
Esempio n. 8
0
def new_roles(field):
    return verify_perm('admin') or handleFormAction(RoleForm, field, add_role)
Esempio n. 9
0
def new_users(field):
    return verify_perm('admin') or handleFormAction(UserForm, field, add_user)
Esempio n. 10
0
def new_production(field):
    return verify_perm('admin') or handleFormAction(ProductionForm, field,
                                                    add_production)
Esempio n. 11
0
def new_client(field):
    return verify_perm('admin') or handleFormAction(ClientForm, field,
                                                    add_client)
Esempio n. 12
0
def new_request(field):
    return verify_perm('add') or handleFormAction(RequestForm, field,
                                                  add_request)