Raise 403 when broadcasting on a suspended service

This mirrors the approach we take for jobs [1].

[1]: 3d71815956/app/job/rest.py (L146)
This commit is contained in:
Ben Thorner
2021-04-19 16:54:25 +01:00
parent a2af8b052a
commit 0507e8d9ad
2 changed files with 19 additions and 0 deletions

View File

@@ -176,6 +176,9 @@ def update_broadcast_message_status(service_id, broadcast_message_id):
validate(data, update_broadcast_message_status_schema)
broadcast_message = dao_get_broadcast_message_by_id_and_service_id(broadcast_message_id, service_id)
if not broadcast_message.service.active:
raise InvalidRequest("Updating broadcast message is not allowed: service is inactive ", 403)
new_status = data['status']
updating_user = get_user_by_id(data['created_by'])