From fc3a5b2e2dbeae3afbdc7288634b7bec7518382a Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 17 May 2024 11:13:18 +0200 Subject: [PATCH] Applied business logic described here https://support.d4science.org/issues/26641 --- .../templates/package/read_base.html | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/ckanext/d4science_theme/templates/package/read_base.html b/ckanext/d4science_theme/templates/package/read_base.html index 4b650c3..b2b8b1f 100644 --- a/ckanext/d4science_theme/templates/package/read_base.html +++ b/ckanext/d4science_theme/templates/package/read_base.html @@ -36,27 +36,18 @@ if(window.addEventListener){ {% if h.check_access('package_update', {'id':pkg.id }) %} {# CODE ADDED BY Francesco Mangiacrapa #} + {# see ticket #26641 - ONLY THE SYSADMINS see the Manage button #} + {% set is_sys_admin = true if (c.userobj and c.userobj.sysadmin) else false %} {% set hide = h.get_cookie_value('ckan_hide_header') %} {# INTO PORTAL - FROM D4SCIENCE PORTAL #} {% if hide and hide == 'true' %} - {% set username_id = c.userobj.id %} - {% set pkg_creator_user_id = pkg.creator_user_id %} - {% set role_for_user = h.d4science_theme_get_user_role_for_group_or_org(pkg.organization.id, username_id) %} - {% if role_for_user %} - {% if role_for_user == 'admin' %} - {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} - {% else %} - {% if role_for_user == 'editor' %} - {# IF THE USER HAS ROLE EDITOR HE/SHE CAN EDIT ONLY ITS DATASET, see related ticket #5119 #} - {% if username_id == pkg_creator_user_id %} - {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} - {% endif %} - {% endif %} - {# NOT SHOW 'Manage' #} - {% endif %} + {% if is_sys_admin %} + {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} {% endif %} {% else %} - {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} + {% if is_sys_admin %} + {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} + {% endif %} {% endif %} {% endif %} {% endblock %}