Skip to content
Snippets Groups Projects
Commit c327f4ad authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Updated url routes for dashboard

parent 55e82257
Branches
Tags
1 merge request!50Upgraded to CKAN 2.10
......@@ -80,13 +80,11 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
# Dashboard
bp_dashboard = dashboard.blueprint
bp_dashboard.add_url_rule(
u'/dashboard', view_func=dashboard.dashboard, strict_slashes=False, defaults={
u'offset': 0
})
u'/dashboard/datasets', view_func=dashboard.datasets)
bp_dashboard.add_url_rule(
u'/dashboard/datasets', view_func=dashboard.dashboard_datasets)
u'/dashboard/organizations', view_func=dashboard.organizations)
bp_dashboard.add_url_rule(
u'/dashboard/<int:offset>', view_func=dashboard.dashboard)
u'/dashboard/groups', view_func=dashboard.groups)
# Harvest
bp_harvest = harvest.blueprint
......
import ckan.plugins.toolkit as toolkit
import ckan.authz as authz
import ckan.logic as logic
import ckan.lib.helpers as h
from ckan.common import g
from flask import Blueprint
from ckan.views.dashboard import index
from ckan.views.dashboard import datasets, organizations, groups
import logging
log = logging.getLogger(__name__)
blueprint = Blueprint('odsh_dashboard', __name__)
blueprint = Blueprint(u'odsh_dashboard', __name__)
def dashboard(offset=0):
log.debug("views.dashboard::dashboard")
@blueprint.before_request
def before_request() -> None:
is_sysadmin = authz.is_sysadmin(g.user)
if not is_sysadmin:
toolkit.abort(403)
return index(offset)
h.flash_error(_(u'Not authorized to see this page'))
return h.redirect_to(u'user.login')
return None
def datasets():
return datasets()
def dashboard_datasets():
log.debug("views.dashboard::dashboard_datasets")
is_sysadmin = authz.is_sysadmin(g.user)
if not is_sysadmin:
toolkit.abort(403)
def organizations():
return organizations()
return index()
def groups():
return groups()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment