Skip to content

Commit

Permalink
[noticket] Fix organization template that checked package_create auth…
Browse files Browse the repository at this point in the history
… incorrectly.
  • Loading branch information
David Read committed Sep 30, 2013
1 parent 218f73b commit 18d3c8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ckan/logic/auth/create.py
Expand Up @@ -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.
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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 %}

Expand Down

0 comments on commit 18d3c8b

Please sign in to comment.