Skip to content

Commit

Permalink
Merge branch '954-org-add-dataset-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
joetsoi committed Jun 26, 2013
2 parents d346ba0 + e414929 commit a84d97a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions ckan/logic/auth/create.py
Expand Up @@ -14,12 +14,17 @@ def package_create(context, data_dict=None):

if not check1:
return {'success': False, 'msg': _('User %s not authorized to create packages') % user}
else:

check2 = _check_group_auth(context,data_dict)
if not check2:
return {'success': False, 'msg': _('User %s not authorized to edit these groups') % user}
check2 = _check_group_auth(context,data_dict)
if not check2:
return {'success': False, 'msg': _('User %s not authorized to edit these groups') % user}

# If an organization is given are we able to add a dataset to it?
data_dict = data_dict or {}
org_id = data_dict.get('organization_id')
if org_id and not new_authz.has_user_permission_for_group_or_org(
org_id, user, 'create_dataset'):
return {'success': False, 'msg': _('User %s not authorized to add dataset to this organization') % user}
return {'success': True}

def file_upload(context, data_dict=None):
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/organization/read.html
@@ -1,7 +1,7 @@
{% extends "organization/read_base.html" %}

{% block page_primary_action %}
{% if h.check_access('organization_update', {'id': c.group_dict.id}) %}
{% 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' %}
{% endif %}
{% endblock %}
Expand Down

0 comments on commit a84d97a

Please sign in to comment.