mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
add option to suppress platform admin temporarily
so that platform admins (us) can view pages as regular users do easily. Simply adds a flag in the session cookie that overrides the actual platform admin flag on the user model if set. This way it's safe, since this only downgrades existing functionality, so if someone managed to alter it they could only get less permissions, not more. You can change this value from the user profile page if either: * you're a platform admin * the flag is set (to any value) on the cookie. This slightly weird check means that we don't check the underlying `user._platform_admin` flag anywhere in the code, even when toggling the suppression.
This commit is contained in:
@@ -1091,6 +1091,7 @@ def api_user_pending(fake_uuid):
|
||||
'permissions': {},
|
||||
'organisations': [],
|
||||
'current_session_id': None,
|
||||
'password_changed_at': str(datetime.utcnow()),
|
||||
}
|
||||
return user_data
|
||||
|
||||
@@ -1114,6 +1115,7 @@ def platform_admin_user(fake_uuid):
|
||||
'view_activity']},
|
||||
'platform_admin': True,
|
||||
'auth_type': 'sms_auth',
|
||||
'password_changed_at': str(datetime.utcnow()),
|
||||
'services': [],
|
||||
'organisations': [],
|
||||
'current_session_id': None,
|
||||
@@ -1443,7 +1445,7 @@ def api_user_request_password_reset(fake_uuid):
|
||||
'state': 'active',
|
||||
'failed_login_count': 5,
|
||||
'permissions': {},
|
||||
'password_changed_at': None,
|
||||
'password_changed_at': str(datetime.utcnow()),
|
||||
'auth_type': 'sms_auth',
|
||||
'organisations': [],
|
||||
'current_session_id': None,
|
||||
@@ -2165,7 +2167,7 @@ def mock_get_users_by_service(mocker):
|
||||
'manage_settings',
|
||||
'manage_api_keys']},
|
||||
'state': 'active',
|
||||
'password_changed_at': None,
|
||||
'password_changed_at': str(datetime.utcnow()),
|
||||
'name': 'Test User',
|
||||
'email_address': 'notify@digital.cabinet-office.gov.uk',
|
||||
'auth_type': 'sms_auth',
|
||||
|
||||
Reference in New Issue
Block a user