From 18d3c8b4a27e789f3e0b5ad00e954ee53cde5129 Mon Sep 17 00:00:00 2001 From: David Read Date: Mon, 30 Sep 2013 13:33:51 +0000 Subject: [PATCH] [noticket] Fix organization template that checked package_create auth incorrectly. --- ckan/logic/auth/create.py | 3 ++- ckan/templates/organization/read.html | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ckan/logic/auth/create.py b/ckan/logic/auth/create.py index a46a91de500..944ba31170d 100644 --- a/ckan/logic/auth/create.py +++ b/ckan/logic/auth/create.py @@ -117,6 +117,7 @@ def user_create(context, data_dict=None): def _check_group_auth(context, data_dict): '''Has this user got update permission for all of the given groups? If there is a package in the context then ignore that package's groups. + (owner_org is checked elsewhere.) :returns: False if not allowed to update one (or more) of the given groups. True otherwise. i.e. True is the default. A blank data_dict mentions no groups, so it returns True. @@ -133,7 +134,7 @@ def _check_group_auth(context, data_dict): api_version = context.get('api_version') or '1' - group_blobs = data_dict.get("groups", []) + group_blobs = data_dict.get('groups', []) groups = set() for group_blob in group_blobs: # group_blob might be a dict or a group_ref diff --git a/ckan/templates/organization/read.html b/ckan/templates/organization/read.html index aae8f995b20..0cbd4093bbc 100644 --- a/ckan/templates/organization/read.html +++ b/ckan/templates/organization/read.html @@ -1,8 +1,8 @@ {% extends "organization/read_base.html" %} {% block page_primary_action %} - {% if h.check_access('package_create', {'organization_id': c.group_dict.id}) %} - {% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %} + {% if h.check_access('package_create', {'owner_org': c.group_dict.id}) %} + {% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.name, class_='btn btn-primary', icon='plus-sign-alt' %} {% endif %} {% endblock %}