示例#1
0
def assert_user_is_logged():
    if AUTH_REQUIRED:
        identity = get_identity()
        if identity is None:
            app.logger.info("Access denied, authentication required")
            prefix = auth_path_prefix()
            return redirect(prefix + '/login?url=%s' % request.url)
示例#2
0
def assert_admin_role():
    identity = get_identity()
    app.logger.debug("Access with identity %s" % identity)
    if not access_control.is_admin(identity):
        if SKIP_LOGIN:
            app.logger.info("Login skipped for user %s" % identity)
            pass  # Allow access without login
        else:
            app.logger.info("Access denied for user %s" % identity)
            prefix = auth_path_prefix()
            if identity:
                # Already logged in, but not with admin role
                return redirect(prefix + '/logout?url=%s' % request.url)
            else:
                return redirect(prefix + '/login?url=%s' % request.url)
示例#3
0
def qwc2_themes():
    qwc2_viewer = qwc2_viewer_handler()
    return with_no_cache_headers(qwc2_viewer.qwc2_themes(get_identity()))
示例#4
0
def qwc2_config():
    qwc2_viewer = qwc2_viewer_handler()
    return with_no_cache_headers(
        qwc2_viewer.qwc2_config(get_identity(), request.args))
示例#5
0
def index():
    qwc2_viewer = qwc2_viewer_handler()
    return qwc2_viewer.qwc2_index(get_identity())
def register():
    return registration_gui.register(get_identity())