Ejemplo n.º 1
0
def people():
    search = request.form.get("search", None)
    sort_by = request.form.get("sort_by", None)
    sort_dir = request.form.get("sort_dir", None)
    limit = request.form.get("limit", PAGE_SIZE)
    offset = request.form.get("offset", 0)
    data, count = person_service.get(session['company_id'], search=search, sort_by=sort_by, sort_dir=sort_dir, limit=limit, offset=offset)
    return json_response({'data': data, 'count': count})
Ejemplo n.º 2
0
def people():
    data, count = person_service.get(
        session['company_id'],
        search=request.args.get('search'),
        sort_by=request.args.get('sort_by'),
        sort_dir=request.args.get('sort_dir'),
        limit=int(request.args.get('limit', PAGE_SIZE)),
        offset=int(request.args.get('offset', 0))
    )
    return json_response({'data': data, 'count': count})
Ejemplo n.º 3
0
def people():
    search = request.form.get("search", None)
    sort_by = request.form.get("sort_by", None)
    sort_dir = request.form.get("sort_dir", None)
    limit = request.form.get("limit", PAGE_SIZE)
    offset = request.form.get("offset", 0)
    data, count = person_service.get(session['company_id'],
                                     search=search,
                                     sort_by=sort_by,
                                     sort_dir=sort_dir,
                                     limit=limit,
                                     offset=offset)
    return json_response({'data': data, 'count': count})
Ejemplo n.º 4
0
def root():
    current_user = session.get('user_id')

    if current_user is None:
        return redirect(url_for('login'))

    permissions = db_wrapper.permissions_get(session['user_id'])
    if permissions is None:
        return redirect(url_for('login'))

    current_user = person_service.get(user_id=current_user)

    return render_template(
        'index.html',
        user_name=current_user.name,
        user_id=current_user.id,
        company_id=current_user.company.id,
        company_name=current_user.company.name,
        image=current_user.image,
        permissions=permissions
    )
Ejemplo n.º 5
0
def password_post(password):
    user = person_service.get(user_id=session['user_id'])
    db_wrapper.authenticate_user(user.email, password['current'])
    db_wrapper.update_password(session['user_id'], password['new'])
    return "Password Updated", 200
Ejemplo n.º 6
0
def user():
    return json_response(person_service.get(user_id=session['user_id']).to_dict())