From 18f3edf1a88920c2f63fd3a2896f43dad832f274 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Tue, 8 Oct 2024 10:43:00 +0200 Subject: [PATCH] Updates for CKAN 2.10 (#2) * Updates for CKAN 2.10 * Updated to use blueprint and view --------- Co-authored-by: Mark Calvert --- ckanext/package_group_permissions/helpers.py | 1 + ckanext/package_group_permissions/plugin.py | 2 +- .../templates/group/snippets/group_item.html | 2 +- .../package_group_permissions/templates/package/group_list.html | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ckanext/package_group_permissions/helpers.py b/ckanext/package_group_permissions/helpers.py index 5cff74c..97faacb 100755 --- a/ckanext/package_group_permissions/helpers.py +++ b/ckanext/package_group_permissions/helpers.py @@ -33,3 +33,4 @@ def get_all_groups(): return [[group['id'], group['display_name']] for group in groups if group['id'] not in pkg_group_ids] + diff --git a/ckanext/package_group_permissions/plugin.py b/ckanext/package_group_permissions/plugin.py index 97f2a77..c3e4ce5 100755 --- a/ckanext/package_group_permissions/plugin.py +++ b/ckanext/package_group_permissions/plugin.py @@ -37,7 +37,7 @@ def member_create(self, next_auth, context, data_dict): :return: """ authorized = False - if g.controller in ['package', 'dataset'] and g.action in ['groups']: + if g.blueprint in ['package', 'dataset'] and g.view in ['groups']: authorized = helpers.user_has_admin_access(include_editor_access=True) if not authorized: diff --git a/ckanext/package_group_permissions/templates/group/snippets/group_item.html b/ckanext/package_group_permissions/templates/group/snippets/group_item.html index 5f34ef1..c3ab48e 100755 --- a/ckanext/package_group_permissions/templates/group/snippets/group_item.html +++ b/ckanext/package_group_permissions/templates/group/snippets/group_item.html @@ -16,7 +16,7 @@ {% block link %} {{ super() }} {% endblock %} - {% if group.user_member or (h.check_access('member_delete', group) and c.controller in ['package', 'dataset'] and c.action in ['groups']) %} + {% if group.user_member or (h.check_access('member_delete', group) and g.blueprint in ['dataset'] and g.view in ['groups']) %} {% endif %} {% endblock %} diff --git a/ckanext/package_group_permissions/templates/package/group_list.html b/ckanext/package_group_permissions/templates/package/group_list.html index e62fe4b..02812a7 100755 --- a/ckanext/package_group_permissions/templates/package/group_list.html +++ b/ckanext/package_group_permissions/templates/package/group_list.html @@ -12,6 +12,7 @@

{{ _('Groups') }}

{% if groups %}
+ {{ h.csrf_input() }}