Esempio n. 1
0
        def wrapper(*args, **kwargs):

            session['stamp'] = time()
            if session.get('user_id') is None:
                session.clear()
                abort(403, 'You are no longer logged in!')

            user_permissions = db_wrapper.permissions_get(session['user_id'])
            for permission in permissions or []:
                if not user_permissions or permission not in user_permissions:
                    abort(400, "You don't have permission to do this!")

            return test_func(*args, **kwargs)
Esempio n. 2
0
def root():
    if session.get('user_id') is None:
        return redirect(url_for('login'))

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

    return render_template('index.html',
                           user_name=session['user_name'],
                           user_id=session['user_id'],
                           company_id=session['company_id'],
                           company_name=session['company_name'],
                           permissions=permissions)
Esempio n. 3
0
def root():
    if session.get('user_id') is None:
        return redirect(url_for('login'))

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

    return render_template(
        'index.html',
        user_name=session['user_name'],
        user_id=session['user_id'],
        company_id=session['company_id'],
        company_name=session['company_name'],
        permissions=permissions
    )
Esempio 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
    )