Skip to content

Commit

Permalink
Merge pull request #79 from FCSCOpendata/fix/sysadmin-view-review-dat…
Browse files Browse the repository at this point in the history
…asets

Admin can view and sort  review pending/rejected dataset in search page
  • Loading branch information
MuhammadIsmailShahzad authored Jul 4, 2022
2 parents a3d71a8 + b2116a8 commit 262e1fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ckanext/fcscopendata/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def theme_update(pkg, groups, context):

def editor_publishing_dataset(owner_org, context):
user_capacity = users_role_for_group_or_org(owner_org, context['user'])
if context['auth_user_obj'].sysadmin:
return False
return user_capacity != 'admin'

def add_user_as_memeber_on_groups(groups, context):
Expand Down
4 changes: 3 additions & 1 deletion ckanext/fcscopendata/templates/package/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
(_('Name Descending'), 'title_string desc'),
(_('Last Modified'), 'metadata_modified desc'),
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ,
(_('Draft'), 'publishing_status asc') if g.userobj.sysadmin else (false, false)
(_('Draft'), 'publishing_status asc') if g.userobj.sysadmin else (false, false),
(_('Review Requested'), 'approval_state asc') if g.userobj.sysadmin else (false, false),
(_('Rejected'), 'approval_state desc') if g.userobj.sysadmin else (false, false)
]
%}
{% snippet 'snippets/search_form.html', form_id='dataset-search-form', type=dataset_type, query=q, sorting=sorting, sorting_selected=sort_by_selected, count=page.item_count, placeholder=_('Search ' + dataset_type + 's') + '...', facets=facets, show_empty=request.params, error=query_error, fields=fields %}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/fcscopendata/templates/snippets/package_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% block package_list_inner %}
{% for package in packages %}
{% snippet 'snippets/package_item.html', package=package, item_class=item_class, hide_resources=hide_resources,
banner=banner, truncate=truncate, truncate_title=truncate_title, in_review=in_review %}
banner=banner, truncate=truncate, truncate_title=truncate_title, in_review=true if g.userobj.sysadmin else in_review %}
{% endfor %}
{% endblock %}
</ul>
Expand Down

0 comments on commit 262e1fb

Please sign in to comment.