How to use the invenio.webuser.page_not_authorized function in invenio

To help you get started, we’ve selected a few invenio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inveniosoftware / invenio / modules / websearch / web / admin / websearchadmin.py View on Github external
except:
        return error_page('Error', req)

    auth = check_user(req,'cfgwebsearch')
    if not auth[0]:
        return page(title="Edit Collection",
                body=wsc.perform_deletecollection(colID=colID,
                                                 ln=ln,
                                                 confirm=confirm),
                uid=uid,
                language=ln,
                req=req,
                navtrail = navtrail_previous_links,
                lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / bibrank / web / admin / bibrankadmin.py View on Github external
auth = brc.check_user(req,'cfgbibrank')
    if not auth[0]:
        return page(title="Modify visibility toward collections",
                body=brc.perform_modifycollection(rnkID=rnkID,
                                                 ln=ln,
                                                 func=func,
                                                 colID=colID,
                                                 confirm=confirm),
                uid=uid,
                language=ln,
                req=req,
                navtrail = navtrail_previous_links,
                lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / webbasket / lib / webbasket_webinterface.py View on Github external
def subscribe(self, req, form):
        """Subscribe to a basket pseudo-interface."""

        argd = wash_urlargd(form, {'bskid': (int, 0),
                                   'of': (str, 'hb'),
                                   'ln': (str, CFG_SITE_LANG)})

        _ = gettext_set_language(argd['ln'])

        uid = getUid(req)
        if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE == 2:
            return page_not_authorized(req, "../yourbaskets/subscribe",
                                       navmenuid = 'yourbaskets')

        if isGuestUser(uid):
            if not CFG_WEBSESSION_DIFFERENTIATE_BETWEEN_GUESTS:
                return redirect_to_url(req, "%s/youraccount/login%s" % (
                    CFG_SITE_SECURE_URL,
                        make_canonical_urlargd({
                    'referer' : "%s/yourbaskets/subscribe%s" % (
                        CFG_SITE_SECURE_URL,
                        make_canonical_urlargd(argd, {})),
                    "ln" : argd['ln']}, {})))

        user_info = collect_user_info(req)
        if not user_info['precached_usebaskets']:
            return page_not_authorized(req, "../", \
                                       text = _("You are not authorized to use baskets."))
github inveniosoftware / invenio / modules / bibindex / web / admin / bibindexadmin.py View on Github external
except:
        return error_page('Error', req)

    auth = bic.check_user(req,'cfgbibindex')
    if not auth[0]:
        return page(title="Edit Logical Field",
                    body=bic.perform_deletefield(fldID=fldID,
                                                 ln=ln,
                                                 confirm=confirm),
                    uid=uid,
                    language=ln,
                    req=req,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / webstat / lib / webstat_webinterface.py View on Github external
def customevent_help(self, req, form):
        """Custom event help page"""
        argd = wash_urlargd(form, {'ln': (str, CFG_SITE_LANG)})
        ln = argd['ln']
        user_info = collect_user_info(req)
        (auth_code, auth_msg) = acc_authorize_action(user_info, 'runwebstatadmin')
        if auth_code:
            return page_not_authorized(req,
                navtrail=self.navtrail % {'ln_link': (ln != CFG_SITE_LANG and '?ln=' + ln) or ''},
                text=auth_msg,
                navmenuid='custom event help',
                ln=ln)

        return page(title="Custom event help",
                    body=perform_display_customevent_help(ln=ln),
                    navtrail="""<a href="%s/stats/%s" class="navtrail">Statistics</a>""" % \
                    (CFG_SITE_URL, (ln != CFG_SITE_LANG and '?ln=' + ln) or ''),
                    description="CDS Personalize, Statistics, Custom event help",
                    keywords="CDS, statistics, custom event help",
                    req=req,
                    lastupdated=__lastupdated__,
                    navmenuid='custom event help',
                    language=ln)
github inveniosoftware / invenio / modules / webalert / lib / webalert_webinterface.py View on Github external
if CFG_ACCESS_CONTROL_LEVEL_SITE >= 1:
            return page_not_authorized(req, "%s/youralerts/display" % \
                                             (CFG_SITE_SECURE_URL,),
                                       navmenuid="youralerts")
        elif uid == -1 or isGuestUser(uid):
            return redirect_to_url(req, "%s/youraccount/login%s" % (
                CFG_SITE_SECURE_URL,
                make_canonical_urlargd({
                    'referer' : "%s/youralerts/display%s" % (
                        CFG_SITE_SECURE_URL,
                        make_canonical_urlargd(argd, {})),
                    "ln" : argd['ln']}, {})))

        user_info = collect_user_info(req)
        if not user_info['precached_usealerts']:
            return page_not_authorized(req, "../", \
                                       text = _("You are not authorized to use alerts."))

        if argd['p'] == 'y':
            _title = _("Popular Searches")
        else:
            _title = _("Your Searches")

        # register event in webstat
        if user_info['email']:
            user_str = "%s (%d)" % (user_info['email'], user_info['uid'])
        else:
            user_str = ""
        try:
            register_customevent("alerts", ["display", "", user_str])
        except:
            register_exception(suffix="Do the webstat tables exists? Try with 'webstatadmin --load-config'")
github inveniosoftware / invenio / modules / bibindex / web / admin / bibindexadmin.py View on Github external
auth = bic.check_user(req,'cfgbibindex')
    if not auth[0]:
        return page(title="Edit Logical Field",
                    body=bic.perform_showdetailsfieldtag(fldID=fldID,
                                                         tagID=tagID,
                                                         ln=ln,
                                                         callback=callback,
                                                         confirm=confirm),
                    uid=uid,
                    language=ln,
                    req=req,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / webbasket / lib / webbasket_webinterface.py View on Github external
"""Modify basket content interface (reorder, suppress record, etc.)"""

        argd = wash_urlargd(form, {'action': (str, ""),
                                   'bskid': (int, -1),
                                   'recid': (int, 0),
                                   'category': (str, CFG_WEBBASKET_CATEGORIES['PRIVATE']),
                                   'topic': (str, ""),
                                   'group': (int, 0),
                                   'of'   : (str, ''),
                                   'ln': (str, CFG_SITE_LANG)})

        _ = gettext_set_language(argd['ln'])

        uid = getUid(req)
        if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1:
            return page_not_authorized(req, "../yourbaskets/modify",
                                       navmenuid = 'yourbaskets')

        if isGuestUser(uid):
            if not CFG_WEBSESSION_DIFFERENTIATE_BETWEEN_GUESTS:
                return redirect_to_url(req, "%s/youraccount/login%s" % (
                    CFG_SITE_SECURE_URL,
                        make_canonical_urlargd({
                    'referer' : "%s/yourbaskets/modify%s" % (
                        CFG_SITE_SECURE_URL,
                        make_canonical_urlargd(argd, {})),
                    "ln" : argd['ln']}, {})))

        user_info = collect_user_info(req)
        if not user_info['precached_usebaskets']:
            return page_not_authorized(req, "../", \
                                       text = _("You are not authorized to use baskets."))
github inveniosoftware / invenio / modules / bibharvest / web / admin / oaiharvestadmin.py View on Github external
navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__,
                    req=req)
    auth = check_user(req,'cfgoaiharvest')
    if not auth[0]:
        return page(title="Holding Pen Record",
                    body=oha.perform_request_viewhprecord(hpupdate_id = hpupdate_id,
                                                          ln=ln,
                                                          confirm=confirm),
                    uid=uid,
                    language=ln,
                    req=req,
                    navtrail = navtrail_previous_links,
                    lastupdated=__lastupdated__)
    else:
        return page_not_authorized(req=req, text=auth[1], navtrail=navtrail_previous_links)
github inveniosoftware / invenio / modules / webstat / lib / webstat_webinterface.py View on Github external
def ill_requests_stats(self, req, form):
        """ILL Requests statistics page."""
        argd = wash_urlargd(form, {'doctype': (str, ""),
                                   'status': (str, ""),
                                   'supplier': (str, ""),
                                   'timespan': (str, "today"),
                                   's_date': (str, ""),
                                   'f_date': (str, ""),
                                   'format': (str, SUITABLE_GRAPH_FORMAT),
                                   'sql': (int, 0),
                                   'ln': (str, CFG_SITE_LANG)})
        ln = argd['ln']
        user_info = collect_user_info(req)
        (auth_code, auth_msg) = acc_authorize_action(user_info, 'runwebstatadmin')
        if auth_code:
            return page_not_authorized(req,
                navtrail=self.navtrail % {'ln_link': (ln != CFG_SITE_LANG and '?ln=' + ln) or ''},
                text=auth_msg,
                navmenuid='circulation ill requests statistics',
                ln=ln)

        return page(title="Circulation ILL Requests statistics",
                    body=perform_display_keyevent('ill requests statistics', argd, req, ln=ln),
                    navtrail="""<a href="%s/stats/%s" class="navtrail">Statistics</a>""" % \
                    (CFG_SITE_URL, (ln != CFG_SITE_LANG and '?ln=' + ln) or ''),
                    description="CDS, Statistics, Circulation ILL Requests statistics",
                    keywords="CDS, statistics, Circulation ILL Requests statistics",
                    req=req,
                    lastupdated=__lastupdated__,
                    navmenuid='circulation ill requests statistics',
                    language=ln)