From 98dc0c5b1a67a7c7b97a1fa02211e9f99360edce Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 16 Jan 2023 12:14:24 +0300 Subject: auth: update privileges format Save privileges with ids of the form :: 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 --- gn3/auth/authorisation/groups.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gn3/auth/authorisation/groups.py') diff --git a/gn3/auth/authorisation/groups.py b/gn3/auth/authorisation/groups.py index ff4dc80..bbabd44 100644 --- a/gn3/auth/authorisation/groups.py +++ b/gn3/auth/authorisation/groups.py @@ -49,7 +49,8 @@ def user_membership(conn: db.DbConnection, user: User) -> Sequence[Group]: return groups @authenticated_p -@authorised_p(("create-group",), error_message="Failed to create group.") +@authorised_p(("system:group:create-group",), + error_message="Failed to create group.") def create_group(conn: db.DbConnection, group_name: str, group_leader: User) -> Group: """Create a group""" @@ -69,7 +70,8 @@ def create_group(conn: db.DbConnection, group_name: str, return group @authenticated_p -@authorised_p(("create-role",), error_message="Could not create the group role") +@authorised_p(("group:role:create-role",), + error_message="Could not create the group role") def create_group_role( conn: db.DbConnection, group: Group, role_name: str, privileges: Iterable[Privilege]) -> GroupRole: -- cgit v1.2.3