Merge pull request #3963 from alphagov/audit-service-resume-178770416

Audit when a service is resumed
This commit is contained in:
Ben Thorner
2021-07-13 12:09:54 +01:00
committed by GitHub
7 changed files with 171 additions and 184 deletions

View File

@@ -31,6 +31,7 @@ from app import (
from app.event_handlers import (
create_archive_service_event,
create_broadcast_account_type_change_event,
create_resume_service_event,
create_suspend_service_event,
)
from app.extensions import zendesk_client
@@ -430,7 +431,7 @@ def archive_service(service_id):
cached_service_user_ids = [user.id for user in current_service.active_users]
service_api_client.archive_service(service_id, cached_service_user_ids)
create_archive_service_event(service_id, archived_by_id=current_user.id)
create_archive_service_event(service_id=service_id, archived_by_id=current_user.id)
flash(
'{} was deleted'.format(current_service.name),
@@ -450,7 +451,7 @@ def archive_service(service_id):
def suspend_service(service_id):
if request.method == 'POST':
service_api_client.suspend_service(service_id)
create_suspend_service_event(service_id, suspended_by_id=current_user.id)
create_suspend_service_event(service_id=service_id, suspended_by_id=current_user.id)
return redirect(url_for('.service_settings', service_id=service_id))
else:
flash("This will suspend the service and revoke all api keys. Are you sure you want to suspend this service?",
@@ -463,6 +464,7 @@ def suspend_service(service_id):
def resume_service(service_id):
if request.method == 'POST':
service_api_client.resume_service(service_id)
create_resume_service_event(service_id=service_id, resumed_by_id=current_user.id)
return redirect(url_for('.service_settings', service_id=service_id))
else:
flash("This will resume the service. New api key are required for this service to use the API.", 'resume')