Skip to content
Snippets Groups Projects
Commit 3e23bc99 authored by anonymous's avatar anonymous
Browse files

ODPSH-293: lock routes

parent b8826304
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import ckan.lib.base as base
from ckan.controllers.home import HomeController
from ckan.controllers.user import UserController
from ckan.controllers.api import ApiController
from ckanext.harvest.controllers.view import ViewController as HarvestController
from ckan.controllers.feed import FeedController
from ckan.controllers.package import PackageController
from ckan.controllers.feed import FeedController, ITEMS_LIMIT, _package_search, _create_atom_id
......@@ -34,6 +35,10 @@ class OdshRouteController(HomeController):
class OdshUserController(UserController):
def index(self):
if not authz.is_sysadmin(c.user):
abort(404)
return super(OdshUserController,self).index()
def me(self, locale=None):
if not c.user:
h.redirect_to(locale=locale, controller='user', action='login',
......@@ -71,9 +76,17 @@ class OdshUserController(UserController):
abort(404)
return super(OdshUserController,self).activity(id, offset)
def register(self, data=None, errors=None, error_summary=None):
if not authz.is_sysadmin(c.user):
abort(404)
return super(OdshUserController,self).register(data, errors, error_summary)
class OdshPackageController(PackageController):
pass
def edit_view(self, id, resource_id, view_id=None):
if not authz.is_sysadmin(c.user):
abort(403)
return super(OdshPackageController,self).edit_view(id, resource_id, view_id)
class OdshApiController(ApiController):
......@@ -183,3 +196,6 @@ class OdshAutocompleteController(ApiController):
suggest = solr_response.raw_response.get('spellcheck')
return base.response.body_file.write(str(suggest))
class OdshHarvestController(HarvestController):
pass
......@@ -173,8 +173,15 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
with SubMapper(map, controller='ckanext.odsh.controller:OdshFeedController') as m:
m.connect('/feeds/custom.atom', action='custom')
# with SubMapper(map, controller='ckanext.odsh.controller:OdshHarvestController') as m:
# m.connect('/harvest', action='custom')
with SubMapper(map, controller='ckanext.odsh.controller:OdshPackageController') as m:
m.connect('new_view', '/dataset/{id}/resource/{resource_id}/new_view', action='edit_view', ckan_icon='pencil-square-o')
# redirect all user routes to custom controller
with SubMapper(map, controller='ckanext.odsh.controller:OdshUserController') as m:
m.connect('user_index', '/user', action='index')
m.connect('/user/edit', action='edit')
m.connect('user_edit', '/user/edit/{id:.*}', action='edit', ckan_icon='cog')
m.connect('user_delete', '/user/delete/{id}', action='delete')
......
......@@ -7,8 +7,12 @@
<div class="module-content error-page">
<div class="error-title">
HTTP Status {{ c.code[0]}}
{%if c.code[0]=='404' or c.code[0]=='403'%}
{%if c.code[0]=='404'%}
<div class="error-body"><h2>Seite nicht gefunden</h2>
{%elif c.code[0]=='403'%}
<div class="error-body"><h2>Zugriff nicht erlaubt</h2>
{% endif %}
<h3>Wie finde ich die gesuchten Inhalte im Landesportal?</h3>
<p><a class="" href="http://www.schleswig-holstein.de/odpstart" title="Zur Startseite">Zur Startseite des Open-Data-Portals</a></p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment