Skip to content

Commit

Permalink
check group name and id during package creation
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk authored and amercader committed Feb 14, 2017
1 parent db260d0 commit 06a9b4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ckan/logic/auth/create.py
Expand Up @@ -178,10 +178,8 @@ def _check_group_auth(context, data_dict):
for group_blob in group_blobs:
# group_blob might be a dict or a group_ref
if isinstance(group_blob, dict):
if api_version == '1':
id = group_blob.get('name')
else:
id = group_blob.get('id')
# use group id by default, but we can accept name as well
id = group_blob.get('id') or group_blob.get('name')
if not id:
continue
else:
Expand Down
3 changes: 3 additions & 0 deletions ckan/tests/legacy/functional/api/test_activity.py
Expand Up @@ -291,6 +291,9 @@ def _create_package(self, user, name=None):

# Create a new package.
request_data = make_package(name)
# quick fix for #3351
request_data['groups'] = []

before = self.record_details(user_id=user_id,
group_ids=[group['name'] for group in request_data['groups']],
apikey=apikey)
Expand Down

0 comments on commit 06a9b4d

Please sign in to comment.