Split the templates permission out again

It will likely be the same people who have permission to create alerts
and edit templates (maybe someone in a comms role).

But combining the two permissions makes the options presented in the
form feel clunky because ‘alerts’ and ‘templates’ are conceptually quite
different.

So I think it makes sense to keep the templates permission the same as
it is for regular Notify services.
This commit is contained in:
Chris Hill-Scott
2021-07-22 14:15:02 +01:00
parent f05e13edf3
commit 694d7cc2ff
2 changed files with 8 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ roles = {
'manage_service': ['manage_users', 'manage_settings'],
'manage_api_keys': ['manage_api_keys'],
'view_activity': ['view_activity'],
'create_broadcasts': ['manage_templates', 'create_broadcasts', 'reject_broadcasts', 'cancel_broadcasts'],
'create_broadcasts': ['create_broadcasts', 'reject_broadcasts', 'cancel_broadcasts'],
'approve_broadcasts': ['approve_broadcasts', 'reject_broadcasts', 'cancel_broadcasts'],
}
@@ -22,7 +22,8 @@ permissions = (
)
broadcast_permissions = (
('create_broadcasts', 'Add new alerts and templates'),
('manage_templates', 'Add and edit templates'),
('create_broadcasts', 'Add new alerts'),
('approve_broadcasts', 'Approve alerts'),
)

View File

@@ -212,12 +212,14 @@ def test_should_show_overview_page_for_broadcast_service(
page = client_request.get('main.manage_users', service_id=SERVICE_ONE_ID)
assert normalize_spaces(page.select('.user-list-item')[0].text) == (
'Test User (you) '
'Can Add new alerts and templates '
'Can Add and edit templates '
'Can Add new alerts '
'Can Approve alerts'
)
assert normalize_spaces(page.select('.user-list-item')[1].text) == (
'Test User With Permissions (you) '
'Cannot Add new alerts and templates '
'Cannot Add and edit templates '
'Cannot Add new alerts '
'Cannot Approve alerts'
)
@@ -326,6 +328,7 @@ def test_broadcast_service_only_shows_relevant_permissions(
assert [
(field['name'], field['value']) for field in page.select('input[type=checkbox]')
] == [
('permissions_field', 'manage_templates'),
('permissions_field', 'create_broadcasts'),
('permissions_field', 'approve_broadcasts'),
]