mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 03:48:25 -04:00
Audit when user permissions are changed
I've used the term "admin_roles" in the event data to try and show that these are not the permissions we store in the DB. This is the name we use for the abstracted form of permissions in the Admin app. While we could store the DB permissions, that would be a bit more effort and arguably it's clearer to keep the event data consistent with the options the user actually saw / chose.
This commit is contained in:
@@ -10,6 +10,7 @@ from app.event_handlers import (
|
||||
create_mobile_number_change_event,
|
||||
create_remove_user_from_service_event,
|
||||
create_resume_service_event,
|
||||
create_set_user_permissions_event,
|
||||
create_suspend_service_event,
|
||||
on_user_logged_in,
|
||||
)
|
||||
@@ -129,3 +130,16 @@ def test_resume_service(client, mock_events):
|
||||
|
||||
create_resume_service_event(**kwargs)
|
||||
mock_events.assert_called_with('resume_service', event_dict(**kwargs))
|
||||
|
||||
|
||||
def test_set_user_permissions(client, mock_events):
|
||||
kwargs = {
|
||||
"user_id": str(uuid.uuid4()),
|
||||
"service_id": str(uuid.uuid4()),
|
||||
"original_admin_roles": set("manage_templates"),
|
||||
"new_admin_roles": set("view_activity"),
|
||||
"set_by_id": str(uuid.uuid4()),
|
||||
}
|
||||
|
||||
create_set_user_permissions_event(**kwargs)
|
||||
mock_events.assert_called_with('set_user_permissions', event_dict(**kwargs))
|
||||
|
||||
Reference in New Issue
Block a user