From 650f4cc3d8f1c51e6a28638028d8640cfb2e9043 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 12 Jun 2018 11:14:36 +0100 Subject: [PATCH] Add platform admin button to enable caseworking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eventually the ability to have the caseworking view for your service will be self-service. But while we’re still building it only we should be able to enable it, for our own testing purposes. So this commit adds platform admin functionality to switch the feature on and off for our services. --- app/main/views/service_settings.py | 8 ++++++++ app/navigation.py | 3 +++ app/templates/views/service-settings.html | 5 +++++ .../service_settings/test_service_setting_permissions.py | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 5030e9ab2..9f8580997 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -322,6 +322,14 @@ def service_switch_email_auth(service_id): return redirect(url_for('.service_settings', service_id=service_id)) +@main.route("/services//service-settings/caseworking") +@login_required +@user_is_platform_admin +def service_switch_caseworking(service_id): + switch_service_permissions(service_id, 'caseworking') + return redirect(url_for('.service_settings', service_id=service_id)) + + @main.route("/services//service-settings/can-send-precompiled-letter") @login_required @user_is_platform_admin diff --git a/app/navigation.py b/app/navigation.py index 0b5f8bfc3..186905a8b 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -229,6 +229,7 @@ class HeaderNavigation(Navigation): 'service_switch_can_send_precompiled_letter', 'service_switch_can_upload_document', 'service_switch_can_send_sms', + 'service_switch_caseworking', 'service_switch_email_auth', 'service_switch_live', 'service_switch_research_mode', @@ -447,6 +448,7 @@ class MainNavigation(Navigation): 'service_switch_can_send_precompiled_letter', 'service_switch_can_upload_document', 'service_switch_can_send_sms', + 'service_switch_caseworking', 'service_switch_email_auth', 'service_switch_live', 'service_switch_research_mode', @@ -653,6 +655,7 @@ class OrgNavigation(Navigation): 'service_switch_can_send_precompiled_letter', 'service_switch_can_upload_document', 'service_switch_can_send_sms', + 'service_switch_caseworking', 'service_switch_email_auth', 'service_switch_live', 'service_switch_research_mode', diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 751ad11e3..b7294f9af 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -364,6 +364,11 @@ {{ 'Stop user auth type editing' if 'email_auth' in current_service.permissions else 'Allow user auth type editing' }} +
  • + + {{ 'Stop granting of caseworking permission' if 'caseworking' in current_service.permissions else 'Allow granting of caseworking permission' }} + +
  • {{ 'Stop uploading documents' if 'upload_document' in current_service.permissions else 'Allow to upload documents' }} diff --git a/tests/app/main/views/service_settings/test_service_setting_permissions.py b/tests/app/main/views/service_settings/test_service_setting_permissions.py index e26450ed0..0e81131da 100644 --- a/tests/app/main/views/service_settings/test_service_setting_permissions.py +++ b/tests/app/main/views/service_settings/test_service_setting_permissions.py @@ -45,6 +45,11 @@ def get_service_settings_page( ({'permissions': []}, '.service_switch_can_upload_document', {}, 'Allow to upload documents'), + ({'permissions': []}, + '.service_switch_caseworking', {}, 'Allow granting of caseworking permission'), + ({'permissions': ['caseworking']}, + '.service_switch_caseworking', {}, 'Stop granting of caseworking permission'), + ({'permissions': ['sms']}, '.service_set_inbound_number', {'set_inbound_sms': True}, 'Allow inbound sms'), ({'active': True}, '.archive_service', {}, 'Archive service'),