Esempio n. 1
0
def index():
    if user_permission.can() or pending_permission.can():
        return render_template('layout.html')
    elif new_permission.can():
        return redirect(url_for('user.access'))

    return redirect(url_for('user.login'))
Esempio n. 2
0
def login():
    if not new_permission.can():
        username = get_sso_username()
        if username is None:
            return redirect(get_sso_url())
        else:
            get_identity(username)
            return redirect(url_for('user.index'))

    return redirect(url_for('user.index'))
Esempio n. 3
0
def access():
    if pending_permission.can():
        flash('Already requested')
        return redirect(url_for('user.index'))
    elif new_permission.can():
        form = UserAccessForm()
        if form.validate_on_submit():
            success = set_request(form)
            if success:
                flash('Request Success!')
            else:
                flash('Request Failed!')
            return redirect(url_for('user.index'))
        else:
            return render_template('GenericForm.html', form=form)
    else:
        return redirect(url_for('user.index'))