mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Enforce only Platform Admin can suspend / resume
This was previously out-of-sync with the superficial restriction in the HTML [1][2]. [1]:6ac593aa5f/app/templates/views/service-settings.html (L462-L468)[2]:6ac593aa5f/app/templates/views/service-settings.html (L471)
This commit is contained in:
@@ -447,7 +447,7 @@ def archive_service(service_id):
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/service-settings/suspend", methods=["GET", "POST"])
|
||||
@user_has_permissions('manage_service')
|
||||
@user_is_platform_admin
|
||||
def suspend_service(service_id):
|
||||
if request.method == 'POST':
|
||||
service_api_client.suspend_service(service_id)
|
||||
@@ -460,7 +460,7 @@ def suspend_service(service_id):
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/service-settings/resume", methods=["GET", "POST"])
|
||||
@user_has_permissions('manage_service')
|
||||
@user_is_platform_admin
|
||||
def resume_service(service_id):
|
||||
if request.method == 'POST':
|
||||
service_api_client.resume_service(service_id)
|
||||
|
||||
@@ -4208,8 +4208,7 @@ def test_cant_archive_inactive_service(
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
create_platform_admin_user(),
|
||||
create_active_user_with_permissions(),
|
||||
pytest.param(create_active_user_no_settings_permission(), marks=pytest.mark.xfail),
|
||||
pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail),
|
||||
))
|
||||
def test_suspend_service_after_confirm(
|
||||
client_request,
|
||||
@@ -4236,8 +4235,7 @@ def test_suspend_service_after_confirm(
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
create_platform_admin_user(),
|
||||
create_active_user_with_permissions(),
|
||||
pytest.param(create_active_user_no_settings_permission(), marks=pytest.mark.xfail),
|
||||
pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail),
|
||||
))
|
||||
def test_suspend_service_prompts_user(
|
||||
client_request,
|
||||
@@ -4278,8 +4276,7 @@ def test_cant_suspend_inactive_service(
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
create_platform_admin_user(),
|
||||
create_active_user_with_permissions(),
|
||||
pytest.param(create_active_user_no_settings_permission(), marks=pytest.mark.xfail),
|
||||
pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail),
|
||||
))
|
||||
def test_resume_service_after_confirm(
|
||||
mocker,
|
||||
@@ -4308,8 +4305,7 @@ def test_resume_service_after_confirm(
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
create_platform_admin_user(),
|
||||
create_active_user_with_permissions(),
|
||||
pytest.param(create_active_user_no_settings_permission(), marks=pytest.mark.xfail),
|
||||
pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail),
|
||||
))
|
||||
def test_resume_service_prompts_user(
|
||||
client_request,
|
||||
|
||||
Reference in New Issue
Block a user