Allow platform admins to cancel broadcasts.

Do not allow platform admins to:
- create broadcasts
- approve broadcasts
- reject broadcasts

that is, unless they have a send_messages permission
for a given service.

This is so platform admins have the minimum permissions necessary
to cancel a broadcast that might have been sent out accidentally.
This commit is contained in:
Pea Tyczynska
2021-04-06 15:08:47 +01:00
parent 11ded9e828
commit 002dd7485d
3 changed files with 93 additions and 17 deletions

View File

@@ -1108,6 +1108,31 @@ def platform_admin_user(fake_uuid):
return user_data
@pytest.fixture(scope='function')
def platform_admin_user_no_service_permissions():
"""
this fixture is for situations where we want to test that platform admin can access
an endpoint even though they have no explicit permissions for that service.
"""
user_data = {'id': uuid4(),
'name': 'Platform admin user no service permissions',
'password': 'somepassword',
'email_address': 'platform2@admin.gov.uk',
'mobile_number': '07700 900763',
'state': 'active',
'failed_login_count': 0,
'permissions': {},
'platform_admin': True,
'auth_type': 'sms_auth',
'password_changed_at': str(datetime.utcnow()),
'services': [],
'organisations': [],
'current_session_id': None,
'logged_in_at': None,
}
return user_data
@pytest.fixture(scope='function')
def api_user_active(fake_uuid):
user_data = {'id': fake_uuid,