Exemple #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)
Exemple #2
0
def signup(field):
    return handleFormAction(SignupForm, field, post_signup)
Exemple #3
0
def login(field):
    return handleFormAction(LoginForm, field, post_login)
Exemple #4
0
def edit_roles(id, field):
    return verify_perm('admin') or handleFormAction(RoleForm, field, edit_role,
                                                    id)
Exemple #5
0
def edit_users(id, field):
    return verify_perm('admin') or handleFormAction(UserForm, field, edit_user,
                                                    id)
Exemple #6
0
def edit_production(id, field):
    return verify_perm('admin') or handleFormAction(ProductionForm, field,
                                                    edit_production, id)
Exemple #7
0
def edit_clients(id, field):
    return verify_perm('admin') or handleFormAction(ClientForm, field,
                                                    edit_client, id)
Exemple #8
0
def new_roles(field):
    return verify_perm('admin') or handleFormAction(RoleForm, field, add_role)
Exemple #9
0
def new_users(field):
    return verify_perm('admin') or handleFormAction(UserForm, field, add_user)
Exemple #10
0
def new_production(field):
    return verify_perm('admin') or handleFormAction(ProductionForm, field,
                                                    add_production)
Exemple #11
0
def new_client(field):
    return verify_perm('admin') or handleFormAction(ClientForm, field,
                                                    add_client)
Exemple #12
0
def new_request(field):
    return verify_perm('add') or handleFormAction(RequestForm, field,
                                                  add_request)