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)
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)
def qwc2_themes(): qwc2_viewer = qwc2_viewer_handler() return with_no_cache_headers(qwc2_viewer.qwc2_themes(get_identity()))
def qwc2_config(): qwc2_viewer = qwc2_viewer_handler() return with_no_cache_headers( qwc2_viewer.qwc2_config(get_identity(), request.args))
def index(): qwc2_viewer = qwc2_viewer_handler() return qwc2_viewer.qwc2_index(get_identity())
def register(): return registration_gui.register(get_identity())