diff options
author | Frederick Muriuki Muriithi | 2023-01-16 12:14:24 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-01-16 12:14:24 +0300 |
commit | 98dc0c5b1a67a7c7b97a1fa02211e9f99360edce (patch) | |
tree | dc0c6f6bc82f11a4282be2dc1c2485340d68b7d0 /tests/unit/auth/fixtures | |
parent | 53371fb668d1d18ba4696b3e4739f26edd677d8d (diff) | |
download | genenetwork3-98dc0c5b1a67a7c7b97a1fa02211e9f99360edce.tar.gz |
auth: update privileges format
Save privileges with ids of the form <top-level>:<sub-level>:<privilege-name>
rather than using a UUID, to reduce indirection levels.
* migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py: new migration
to change the schema and IDs for the privileges.
* Update code to use new privileges format
* gn3/auth/authorisation/checks.py
* gn3/auth/authorisation/groups.py
* gn3/auth/authorisation/privileges.py
* gn3/auth/authorisation/resources.py
* gn3/auth/authorisation/roles.py
* migrations/auth/20230116_01_KwuJ3-rework-privileges-schema.py
* tests/unit/auth/fixtures/role_fixtures.py
* tests/unit/auth/test_groups.py
* tests/unit/auth/test_privileges.py
* tests/unit/auth/test_roles.py
Diffstat (limited to 'tests/unit/auth/fixtures')
-rw-r--r-- | tests/unit/auth/fixtures/role_fixtures.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/unit/auth/fixtures/role_fixtures.py b/tests/unit/auth/fixtures/role_fixtures.py index e1e1680..cde3d96 100644 --- a/tests/unit/auth/fixtures/role_fixtures.py +++ b/tests/unit/auth/fixtures/role_fixtures.py @@ -9,15 +9,14 @@ from gn3.auth.authorisation.privileges import Privilege RESOURCE_READER_ROLE = Role( uuid.UUID("c3ca2507-ee24-4835-9b31-8c21e1c072d3"), "resource_reader", - (Privilege(uuid.UUID("7f261757-3211-4f28-a43f-a09b800b164d"), - "view-resource"),)) + (Privilege("group:resource:view-resource", + "view a resource and use it in computations"),)) RESOURCE_EDITOR_ROLE = Role( uuid.UUID("89819f84-6346-488b-8955-86062e9eedb7"), "resource_editor", ( - Privilege(uuid.UUID("7f261757-3211-4f28-a43f-a09b800b164d"), - "view-resource"), - Privilege(uuid.UUID("2f980855-959b-4339-b80e-25d1ec286e21"), - "edit-resource"))) + Privilege("group:resource:view-resource", + "view a resource and use it in computations"), + Privilege("group:resource:edit-resource", "edit/update a resource"))) TEST_ROLES = (RESOURCE_READER_ROLE, RESOURCE_EDITOR_ROLE) |