diff --git a/app/config.py b/app/config.py index ebacbc1647..dff025968a 100644 --- a/app/config.py +++ b/app/config.py @@ -91,7 +91,6 @@ class Config(object): FF_SALESFORCE_CONTACT = env.bool("FF_SALESFORCE_CONTACT", True) FF_CARETAKER = env.bool("FF_CARETAKER", False) FF_USE_BILLABLE_UNITS = env.bool("FF_USE_BILLABLE_UNITS", False) - FF_ADD_TEMPLATE_PERM = env.bool("FF_ADD_TEMPLATE_PERM", False) FF_REPORT_API = env.bool("FF_REPORT_API", False) # Comma-separated list of service IDs allowed to use file attachments. @@ -208,7 +207,6 @@ class Development(Config): DEBUG = True VITE_HMR_ENABLED = env.bool("VITE_HMR_ENABLED", True) DEBUG_KEY = "debug" - FF_ADD_TEMPLATE_PERM = True FF_REPORT_API = env.bool("FF_REPORT_API", False) MOU_BUCKET_NAME = "notify.tools-mou" ONE_CLICK_UNSUB_ALL_SERVICES = True @@ -283,7 +281,6 @@ class Production(Config): class Staging(Production): - FF_ADD_TEMPLATE_PERM = True NOTIFY_ENVIRONMENT = NotifyEnv.STAGING.value NOTIFY_LOG_LEVEL = "INFO" SYSTEM_STATUS_URL = "https://status.staging.notification.cdssandbox.xyz" @@ -297,7 +294,6 @@ class Scratch(Production): class Dev(Production): - FF_ADD_TEMPLATE_PERM = True NOTIFY_ENVIRONMENT = NotifyEnv.DEV.value NOTIFY_LOG_LEVEL = "INFO" diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index a20ab4f82f..e0d2e2a2c0 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -117,7 +117,7 @@ def create_api_key(service_id): form=form, disabled_options=disabled_options, option_hints=option_hints, - show_manage_templates=current_app.config["FF_ADD_TEMPLATE_PERM"] and current_user.has_permissions("manage_api_keys"), + show_manage_templates=current_user.has_permissions("manage_api_keys"), show_manage_reports=current_app.config["FF_REPORT_API"] and current_user.has_permissions("manage_api_keys"), ) diff --git a/tests/app/main/test_create_api_key_form.py b/tests/app/main/test_create_api_key_form.py index f4ba4c8831..e1139aaf62 100644 --- a/tests/app/main/test_create_api_key_form.py +++ b/tests/app/main/test_create_api_key_form.py @@ -74,8 +74,7 @@ def test_create_api_key_page_shows_manage_templates_checkbox( mock_get_live_service, mock_has_permissions, ): - with set_config(app_, "FF_ADD_TEMPLATE_PERM", True): - page = client_request.get("main.create_api_key", service_id=SERVICE_ONE_ID) + page = client_request.get("main.create_api_key", service_id=SERVICE_ONE_ID) checkbox = page.find("input", {"name": "permissions", "type": "checkbox"}) assert checkbox is not None @@ -99,17 +98,16 @@ def test_create_api_key_with_manage_templates_permission( return_value={"data": {"key": fake_uuid, "key_name": key_name_fixed}}, ) - with set_config(app_, "FF_ADD_TEMPLATE_PERM", True): - client_request.post( - "main.create_api_key", - service_id=SERVICE_ONE_ID, - _data={ - "key_name": key_name_from_user, - "key_type": "normal", - "permissions": "manage_templates", - }, - _expected_status=200, - ) + client_request.post( + "main.create_api_key", + service_id=SERVICE_ONE_ID, + _data={ + "key_name": key_name_from_user, + "key_type": "normal", + "permissions": "manage_templates", + }, + _expected_status=200, + ) post.assert_called_once_with( url="/service/{}/api-key".format(SERVICE_ONE_ID), @@ -140,16 +138,15 @@ def test_create_api_key_without_manage_templates_permission( return_value={"data": {"key": fake_uuid, "key_name": key_name_fixed}}, ) - with set_config(app_, "FF_ADD_TEMPLATE_PERM", True): - client_request.post( - "main.create_api_key", - service_id=SERVICE_ONE_ID, - _data={ - "key_name": key_name_from_user, - "key_type": "normal", - }, - _expected_status=200, - ) + client_request.post( + "main.create_api_key", + service_id=SERVICE_ONE_ID, + _data={ + "key_name": key_name_from_user, + "key_type": "normal", + }, + _expected_status=200, + ) post.assert_called_once_with( url="/service/{}/api-key".format(SERVICE_ONE_ID),