Add an audit event when a service's broadcast permissions change

This adds an audit event to the `events` table when the broadcast
permissions for a service (the service mode, channel or provider
restriction) changes.
This commit is contained in:
Katie Smith
2021-03-04 12:09:28 +00:00
parent 187a38a0e9
commit 0561937c13
4 changed files with 65 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ from app import (
service_api_client,
user_api_client,
)
from app.event_handlers import create_broadcast_account_type_change_event
from app.extensions import zendesk_client
from app.formatters import email_safe
from app.main import main
@@ -333,6 +334,13 @@ def service_set_broadcast_account_type(service_id):
broadcast_channel=form.account_type.broadcast_channel,
provider_restriction=form.account_type.provider_restriction
)
create_broadcast_account_type_change_event(
service_id=current_service.id,
changed_by_id=current_user.id,
service_mode=form.account_type.service_mode,
broadcast_channel=form.account_type.broadcast_channel,
provider_restriction=form.account_type.provider_restriction,
)
return redirect(url_for(".service_settings", service_id=service_id))