예제 #1
0
파일: views.py 프로젝트: ianluddy/flock
        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)
예제 #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)
예제 #3
0
파일: views.py 프로젝트: iluddy/flock
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
    )
예제 #4
0
파일: views.py 프로젝트: ianluddy/flock
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
    )