Skip to content

Commit

Permalink
Merge pull request #8 from FCSCOpendata/fix/approval-auth-check
Browse files Browse the repository at this point in the history
Approval auth check  condition refactored.
  • Loading branch information
MuhammadIsmailShahzad authored Jul 6, 2022
2 parents 105b48a + 4c1ae51 commit 7274daa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ckanext/datasetapproval/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ def _raise_not_authz_or_not_pending(id):
dataset_dict = toolkit.get_action('package_show') \
({u"ignore_auth": True}, {'id': id})
permission = users_role_for_group_or_org(dataset_dict.get('owner_org'), toolkit.c.userobj.name)
if not permission and toolkit.c.userobj.sysadmin:
return
elif permission != 'admin' or dataset_dict.get('approval_state') != 'pending':
is_pending = dataset_dict.get('approval_state') == 'pending'

if is_pending and (toolkit.c.userobj.sysadmin or permission == 'admin'):
return
else :
raise toolkit.abort(404, 'Dataset "{}" not found'.format(id))

def _make_action(package_id, action='reject'):
Expand Down

0 comments on commit 7274daa

Please sign in to comment.