Allow users with new broadcast permissions access to routes

Added two new permissions - `create_broadcasts` and
`approve_broadcasts`. These new permissions get added to the
`has_permissions` decorator of the broadcast routes to allow the routes
to be accessed with either the old permissions on the new ones while we
switch over.

We were using the `send_messages` permission for the broadcast routes.
By having two new permissions we can allow a more granular control of
these routes.
This commit is contained in:
Katie Smith
2021-06-17 18:03:58 +01:00
parent 078ac10c8d
commit a66a31c944
4 changed files with 145 additions and 22 deletions

View File

@@ -3593,6 +3593,33 @@ def create_active_user_view_permissions(with_unique_id=False):
)
def create_active_user_create_broadcasts_permissions(with_unique_id=False):
return create_service_one_user(
id=str(uuid4()) if with_unique_id else sample_uuid(),
name='Test User Create Broadcasts Permission',
permissions={SERVICE_ONE_ID: [
'manage_templates',
'create_broadcasts',
'reject_broadcasts',
'cancel_broadcasts',
]},
auth_type='webauthn_auth',
)
def create_active_user_approve_broadcasts_permissions(with_unique_id=False):
return create_service_one_user(
id=str(uuid4()) if with_unique_id else sample_uuid(),
name='Test User Approve Broadcasts Permission',
permissions={SERVICE_ONE_ID: [
'approve_broadcasts',
'reject_broadcasts',
'cancel_broadcasts',
]},
auth_type='webauthn_auth',
)
def create_active_caseworking_user(with_unique_id=False):
return create_user(
id=str(uuid4()) if with_unique_id else sample_uuid(),