Remove ‘suspend API keys’

This was an early reckon feature. There were a few of problems with
it:
- it worked on the service, not just on the API keys as described
- it was back to front, ‘suspending’ a service set `active` to `True`,
  reactivating it set `active` to `False`
- no part of the API actually respected the `active` flag on a service

The same intent can be acheived by either:
- revoking an API key
- having a platform admin put your service back into trial mode

So this commit removes the link and the code behind it.
This commit is contained in:
Chris Hill-Scott
2016-08-22 14:39:57 +01:00
parent 036f2a8880
commit 05a493f1e8
4 changed files with 46 additions and 207 deletions

View File

@@ -157,41 +157,6 @@ def service_switch_research_mode(service_id):
return redirect(url_for('.service_settings', service_id=service_id))
@main.route("/services/<service_id>/service-settings/status", methods=['GET', 'POST'])
@login_required
@user_has_permissions('manage_settings', admin_override=True)
def service_status_change(service_id):
if request.method == 'GET':
return render_template(
'views/service-settings/status.html'
)
elif request.method == 'POST':
return redirect(url_for('.service_status_change_confirm', service_id=service_id))
@main.route("/services/<service_id>/service-settings/status/confirm", methods=['GET', 'POST'])
@login_required
@user_has_permissions('manage_settings', admin_override=True)
def service_status_change_confirm(service_id):
# Validate password for form
def _check_password(pwd):
return user_api_client.verify_password(current_user.id, pwd)
form = ConfirmPasswordForm(_check_password)
if form.validate_on_submit():
service_api_client.update_service(
current_service['id'],
active=True
)
return redirect(url_for('.service_settings', service_id=service_id))
return render_template(
'views/service-settings/confirm.html',
heading='Turn off all outgoing notifications',
destructive=True,
form=form)
@main.route("/services/<service_id>/service-settings/delete", methods=['GET', 'POST'])
@login_required
@user_has_permissions('manage_settings', admin_override=True)

View File

@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %}
{% from "components/browse-list.html" import browse_list %}
{% from "components/table.html" import mapping_table, row, text_field, edit_field %}
{% from "components/table.html" import mapping_table, row, text_field, edit_field, field %}
{% block page_title %}
Settings GOV.UK Notify
@@ -10,46 +10,53 @@
<h1 class="heading-large">Settings</h1>
{% call mapping_table(
caption='Settings',
field_headings=['Label', 'Value', 'Action'],
field_headings_visible=False,
caption_visible=False
) %}
{% call row() %}
{{ text_field('Service name' )}}
{{ text_field(current_service.name) }}
{{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }}
<div class="dashboard-table">
{% call mapping_table(
caption='Settings',
field_headings=['Label', 'Value', 'Action'],
field_headings_visible=False,
caption_visible=False
) %}
{% call row() %}
{{ text_field('Service name' )}}
{{ text_field(current_service.name) }}
{{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Email reply to address')}}
{{ text_field(
current_service.reply_to_email_address,
status='' if current_service.reply_to_email_address else 'default'
) }}
{{ edit_field('Change', url_for('.service_set_reply_to_email', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Text message sender')}}
{{ text_field(current_service.sms_sender or '40604') }}
{{ edit_field('Change', url_for('.service_set_sms_sender', service_id=current_service.id)) }}
{% endcall %}
{% endcall %}
{% call row() %}
{{ text_field('Email reply to address')}}
{{ text_field(
current_service.reply_to_email_address,
status='' if current_service.reply_to_email_address else 'default'
) }}
{{ edit_field('Change', url_for('.service_set_reply_to_email', service_id=current_service.id)) }}
{% call mapping_table(
caption='Restrictions',
field_headings=['Label', 'Value', 'Action'],
field_headings_visible=False,
caption_visible=True
) %}
{% call row() %}
{% if current_service.restricted %}
{{ text_field('Trial mode') }}
{{ text_field('On') }}
{{ edit_field('Request to go live', url_for('.service_request_to_go_live', service_id=current_service.id)) }}
{% else %}
{{ text_field('Trial mode') }}
{{ text_field('Off')}}
{{ edit_field() }}
{% endif %}
{% endcall %}
{% endcall %}
{% call row() %}
{{ text_field('Text message sender')}}
{{ text_field(current_service.sms_sender or '40604') }}
{{ edit_field('Change', url_for('.service_set_sms_sender', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Mode')}}
{% if current_service.restricted %}
{{ text_field('Trial') }}
{{ edit_field('Go live', url_for('.service_request_to_go_live', service_id=current_service.id)) }}
{% else %}
{{ text_field('Live') }}
{{ edit_field() }}
{% endif %}
{% endcall %}
{% call row() %}
{{ text_field('Active')}}
{{ text_field(current_service.active) }}
{{ edit_field('Suspend', url_for('.service_status_change', service_id=current_service.id)) }}
{% endcall %}
{% endcall %}
</div>
{% if current_user.has_permissions([], admin_override=True) %}

View File

@@ -1,38 +0,0 @@
{% extends "withnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
Temporrily suspend API keys GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Temporarily suspend API keys</h1>
<div class="grid-row">
<div class="column-three-quarters">
<p>
Youll still be able to send notifications to yourself by uploading a
CSV file.
</p>
<p>
You can start sending notifications again when youre ready.
</p>
<form method="post">
{{ page_footer(
'Suspend API keys',
destructive=True,
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
) }}
</form>
</div>
</div>
{% endblock %}