Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
3e23bc99
Commit
3e23bc99
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
ODPSH-293: lock routes
parent
b8826304
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ckanext/odsh/controller.py
+17
-1
17 additions, 1 deletion
ckanext/odsh/controller.py
ckanext/odsh/plugin.py
+7
-0
7 additions, 0 deletions
ckanext/odsh/plugin.py
ckanext/odsh/templates/error_document_template.html
+6
-2
6 additions, 2 deletions
ckanext/odsh/templates/error_document_template.html
with
30 additions
and
3 deletions
ckanext/odsh/controller.py
+
17
−
1
View file @
3e23bc99
...
@@ -2,6 +2,7 @@ import ckan.lib.base as base
...
@@ -2,6 +2,7 @@ import ckan.lib.base as base
from
ckan.controllers.home
import
HomeController
from
ckan.controllers.home
import
HomeController
from
ckan.controllers.user
import
UserController
from
ckan.controllers.user
import
UserController
from
ckan.controllers.api
import
ApiController
from
ckan.controllers.api
import
ApiController
from
ckanext.harvest.controllers.view
import
ViewController
as
HarvestController
from
ckan.controllers.feed
import
FeedController
from
ckan.controllers.feed
import
FeedController
from
ckan.controllers.package
import
PackageController
from
ckan.controllers.package
import
PackageController
from
ckan.controllers.feed
import
FeedController
,
ITEMS_LIMIT
,
_package_search
,
_create_atom_id
from
ckan.controllers.feed
import
FeedController
,
ITEMS_LIMIT
,
_package_search
,
_create_atom_id
...
@@ -34,6 +35,10 @@ class OdshRouteController(HomeController):
...
@@ -34,6 +35,10 @@ class OdshRouteController(HomeController):
class
OdshUserController
(
UserController
):
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
):
def
me
(
self
,
locale
=
None
):
if
not
c
.
user
:
if
not
c
.
user
:
h
.
redirect_to
(
locale
=
locale
,
controller
=
'
user
'
,
action
=
'
login
'
,
h
.
redirect_to
(
locale
=
locale
,
controller
=
'
user
'
,
action
=
'
login
'
,
...
@@ -71,9 +76,17 @@ class OdshUserController(UserController):
...
@@ -71,9 +76,17 @@ class OdshUserController(UserController):
abort
(
404
)
abort
(
404
)
return
super
(
OdshUserController
,
self
).
activity
(
id
,
offset
)
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
):
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
):
class
OdshApiController
(
ApiController
):
...
@@ -183,3 +196,6 @@ class OdshAutocompleteController(ApiController):
...
@@ -183,3 +196,6 @@ class OdshAutocompleteController(ApiController):
suggest
=
solr_response
.
raw_response
.
get
(
'
spellcheck
'
)
suggest
=
solr_response
.
raw_response
.
get
(
'
spellcheck
'
)
return
base
.
response
.
body_file
.
write
(
str
(
suggest
))
return
base
.
response
.
body_file
.
write
(
str
(
suggest
))
class
OdshHarvestController
(
HarvestController
):
pass
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
7
−
0
View file @
3e23bc99
...
@@ -173,8 +173,15 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
...
@@ -173,8 +173,15 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
with
SubMapper
(
map
,
controller
=
'
ckanext.odsh.controller:OdshFeedController
'
)
as
m
:
with
SubMapper
(
map
,
controller
=
'
ckanext.odsh.controller:OdshFeedController
'
)
as
m
:
m
.
connect
(
'
/feeds/custom.atom
'
,
action
=
'
custom
'
)
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
# redirect all user routes to custom controller
with
SubMapper
(
map
,
controller
=
'
ckanext.odsh.controller:OdshUserController
'
)
as
m
:
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
'
,
action
=
'
edit
'
)
m
.
connect
(
'
user_edit
'
,
'
/user/edit/{id:.*}
'
,
action
=
'
edit
'
,
ckan_icon
=
'
cog
'
)
m
.
connect
(
'
user_edit
'
,
'
/user/edit/{id:.*}
'
,
action
=
'
edit
'
,
ckan_icon
=
'
cog
'
)
m
.
connect
(
'
user_delete
'
,
'
/user/delete/{id}
'
,
action
=
'
delete
'
)
m
.
connect
(
'
user_delete
'
,
'
/user/delete/{id}
'
,
action
=
'
delete
'
)
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/templates/error_document_template.html
+
6
−
2
View file @
3e23bc99
...
@@ -7,8 +7,12 @@
...
@@ -7,8 +7,12 @@
<div
class=
"module-content error-page"
>
<div
class=
"module-content error-page"
>
<div
class=
"error-title"
>
<div
class=
"error-title"
>
HTTP Status {{ c.code[0]}}
HTTP Status {{ c.code[0]}}
{%if c.code[0]=='404' or c.code[0]=='403'%}
{%if c.code[0]=='404'%}
{%if c.code[0]=='404'%}
<div
class=
"error-body"
><h2>
Seite nicht gefunden
</h2>
<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>
<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>
<p><a
class=
""
href=
"http://www.schleswig-holstein.de/odpstart"
title=
"Zur Startseite"
>
Zur Startseite des Open-Data-Portals
</a></p>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment