mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-03 23:51:22 -04:00
move service to broadcast org when broadcasting is enabled
we want to keep track of all broadcast services across govt easily. As such, when broadcasting is enabled for a service, we've decided we're going to add the service to a special broadcasting organisation. This organisation is defined in the config file. It's hard coded for production, if you want to test locally, you should set BROADCAST_ORGANISATION_ID in your local environment.
This commit is contained in:
@@ -100,9 +100,16 @@ class Service(JSONModel):
|
||||
)
|
||||
|
||||
def force_broadcast_permission_on(self):
|
||||
return self.update_permissions(
|
||||
ret = self.update_permissions(
|
||||
set(self.permissions) - {'email', 'sms', 'letter'} | {'broadcast'}
|
||||
)
|
||||
broadcast_org_id = current_app.config['BROADCAST_ORGANISATION_ID']
|
||||
if broadcast_org_id:
|
||||
organisations_client.update_service_organisation(
|
||||
service_id=self.id,
|
||||
org_id=broadcast_org_id
|
||||
)
|
||||
return ret
|
||||
|
||||
def update_permissions(self, permissions):
|
||||
return self.update(permissions=list(permissions))
|
||||
|
||||
Reference in New Issue
Block a user