Skip to content

Commit 2a486a2

Browse files
author
Thomas Hanke
committed
Merge branch 'main' of github.com:Mat-O-Lab/ckanext-matolabtheme
2 parents dc00a44 + ccca9e4 commit 2a486a2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ckanext/matolabtheme/views.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blueprint = Blueprint("matolabtheme", __name__)
1010

1111
import ckan.logic.schema
12-
from ckan.common import config, request, current_user
12+
from ckan.common import _, config, request, current_user
1313
import ckan.lib.navl.dictization_functions as dict_fns
1414
from ckan.views.home import CACHE_PARAMETERS
1515
import ckan.logic as logic
@@ -25,6 +25,14 @@
2525

2626
class BannerConfigView(MethodView):
2727
def post(self) -> Union[str, Response]:
28+
try:
29+
context: Context = {
30+
"user": current_user.name,
31+
"auth_user_obj": current_user
32+
}
33+
logic.check_access(u'sysadmin', context)
34+
except logic.NotAuthorized:
35+
base.abort(403, _(u'Need to be system administrator to administer'))
2836
try:
2937
req = request.form.copy()
3038
req.update(request.files.to_dict())
@@ -97,6 +105,14 @@ def post(self) -> Union[str, Response]:
97105
return h.redirect_to("matolabtheme.banner_config")
98106

99107
def get(self) -> str:
108+
try:
109+
context: Context = {
110+
"user": current_user.name,
111+
"auth_user_obj": current_user
112+
}
113+
logic.check_access(u'sysadmin', context)
114+
except logic.NotAuthorized:
115+
base.abort(403, _(u'Need to be system administrator to administer'))
100116
schema = ckan.logic.schema.update_configuration_schema()
101117
data = {}
102118
for key in schema:

0 commit comments

Comments
 (0)