Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Mat-O-Lab/ckanext-matolabtheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hanke committed Feb 12, 2025
2 parents dc00a44 + ccca9e4 commit 2a486a2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ckanext/matolabtheme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
blueprint = Blueprint("matolabtheme", __name__)

import ckan.logic.schema
from ckan.common import config, request, current_user
from ckan.common import _, config, request, current_user
import ckan.lib.navl.dictization_functions as dict_fns
from ckan.views.home import CACHE_PARAMETERS
import ckan.logic as logic
Expand All @@ -25,6 +25,14 @@

class BannerConfigView(MethodView):
def post(self) -> Union[str, Response]:
try:
context: Context = {
"user": current_user.name,
"auth_user_obj": current_user
}
logic.check_access(u'sysadmin', context)
except logic.NotAuthorized:
base.abort(403, _(u'Need to be system administrator to administer'))
try:
req = request.form.copy()
req.update(request.files.to_dict())
Expand Down Expand Up @@ -97,6 +105,14 @@ def post(self) -> Union[str, Response]:
return h.redirect_to("matolabtheme.banner_config")

def get(self) -> str:
try:
context: Context = {
"user": current_user.name,
"auth_user_obj": current_user
}
logic.check_access(u'sysadmin', context)
except logic.NotAuthorized:
base.abort(403, _(u'Need to be system administrator to administer'))
schema = ckan.logic.schema.update_configuration_schema()
data = {}
for key in schema:
Expand Down

0 comments on commit 2a486a2

Please sign in to comment.