Skip to content

Commit

Permalink
[QCDP24-31] removed close datarequest button (#10)
Browse files Browse the repository at this point in the history
* [QCDP24-31] removed close datarequest button

* Added decorator `auth_sysadmins_check` too prevent sysadmin users from being automatically authorised

---------

Co-authored-by: Mark Calvert <[email protected]>
  • Loading branch information
awset and MarkCalvert authored Sep 9, 2024
1 parent 414ad3f commit 06d9ba8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
6 changes: 4 additions & 2 deletions ckanext/datarequests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from ckan import authz
from ckan.plugins.toolkit import current_user, h
from ckan.plugins.toolkit import asbool, auth_allow_anonymous_access, config, get_action
from ckan.plugins.toolkit import asbool, auth_allow_anonymous_access, config, get_action, auth_sysadmins_check

from . import constants, db
from .actions import _dictize_datarequest
Expand Down Expand Up @@ -100,8 +100,10 @@ def delete_datarequest(context, data_dict):
return auth_if_creator(context, data_dict, constants.SHOW_DATAREQUEST)


@auth_sysadmins_check
def close_datarequest(context, data_dict):
return auth_if_creator(context, data_dict, constants.SHOW_DATAREQUEST)
# Close data request feature is removed in this project.
return {'success': False}


def comment_datarequest(context, data_dict):
Expand Down
16 changes: 0 additions & 16 deletions ckanext/datarequests/templates/datarequests/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
{% link_for _('Manage'), named_route='datarequest.update', id=datarequest_id, class_='btn btn-default', icon='wrench' %}
{% endif %}

{% if h.check_access('close_datarequest', {'id':datarequest_id }) and not c.datarequest.closed %}
{% link_for _('Close'), named_route='datarequest.close', id=datarequest_id, class_='btn btn-danger', icon='lock' %}
{% endif %}

{% endblock %}

{% block content_primary_nav %}
Expand All @@ -39,18 +35,6 @@
{% endblock %}

{% block primary_content_inner %}
{% if c.datarequest.closed %}
<span class="uppercase label label-closed pull-right">
<i class="icon-lock fa fa-lock"></i>
{{ _('Closed') }}
</span>
{% else %}
<span class="uppercase label label-open pull-right">
<i class="icon-unlock fa fa-unlock"></i>
{{ _('Open') }}
</span>
{% endif %}

<h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ c.datarequest.get('title') }}{% endblock %}</h1>

{% block datarequest_description %}
Expand Down

0 comments on commit 06d9ba8

Please sign in to comment.