mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
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:
@@ -396,11 +396,14 @@ def service_confirm_broadcast_account_type(service_id, account_type):
|
||||
abort(404)
|
||||
|
||||
if form.validate_on_submit():
|
||||
cached_service_user_ids = [user.id for user in current_service.active_users]
|
||||
|
||||
service_api_client.set_service_broadcast_settings(
|
||||
current_service.id,
|
||||
service_mode=form.account_type.service_mode,
|
||||
broadcast_channel=form.account_type.broadcast_channel,
|
||||
provider_restriction=form.account_type.provider_restriction
|
||||
provider_restriction=form.account_type.provider_restriction,
|
||||
cached_service_user_ids=cached_service_user_ids
|
||||
)
|
||||
create_broadcast_account_type_change_event(
|
||||
service_id=current_service.id,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user