Clear user cache when broadcast service settings form is submitted

When the broadcast service settings form is submitted it now removes all
permissions for users in notifications-api. This means it should be
clearing the user cache.
This commit is contained in:
Katie Smith
2021-07-13 17:06:35 +01:00
parent aefbe7709b
commit 5b52b6f9bf
4 changed files with 29 additions and 4 deletions

View File

@@ -618,13 +618,16 @@ class ServiceAPIClient(NotifyAdminAPIClient):
@cache.delete('service-{service_id}')
def set_service_broadcast_settings(
self, service_id, service_mode, broadcast_channel, provider_restriction
self, service_id, service_mode, broadcast_channel, provider_restriction, cached_service_user_ids
):
"""
service_mode is one of "training" or "live"
broadcast channel is one of "test" or "severe"
broadcast channel is one of "operator", "test", "severe", "government"
provider_restriction is one of "all", "three", "o2", "vodafone", "ee"
"""
if cached_service_user_ids:
redis_client.delete(*map('user-{}'.format, cached_service_user_ids))
data = {
"service_mode": service_mode,
"broadcast_channel": broadcast_channel,