|
9 | 9 | blueprint = Blueprint("matolabtheme", __name__)
|
10 | 10 |
|
11 | 11 | import ckan.logic.schema
|
12 |
| -from ckan.common import config, request, current_user |
| 12 | +from ckan.common import _, config, request, current_user |
13 | 13 | import ckan.lib.navl.dictization_functions as dict_fns
|
14 | 14 | from ckan.views.home import CACHE_PARAMETERS
|
15 | 15 | import ckan.logic as logic
|
|
25 | 25 |
|
26 | 26 | class BannerConfigView(MethodView):
|
27 | 27 | 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')) |
28 | 36 | try:
|
29 | 37 | req = request.form.copy()
|
30 | 38 | req.update(request.files.to_dict())
|
@@ -97,6 +105,14 @@ def post(self) -> Union[str, Response]:
|
97 | 105 | return h.redirect_to("matolabtheme.banner_config")
|
98 | 106 |
|
99 | 107 | 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')) |
100 | 116 | schema = ckan.logic.schema.update_configuration_schema()
|
101 | 117 | data = {}
|
102 | 118 | for key in schema:
|
|
0 commit comments