From 8621b737b01be5a6f238725c65771dea1410f0bb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 7 Mar 2023 13:53:29 +0300 Subject: auth: group_roles: Enable addition/deletion of privileges --- gn3/auth/authorisation/roles/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3/auth/authorisation/roles') diff --git a/gn3/auth/authorisation/roles/models.py b/gn3/auth/authorisation/roles/models.py index bb7ea73..be04985 100644 --- a/gn3/auth/authorisation/roles/models.py +++ b/gn3/auth/authorisation/roles/models.py @@ -17,7 +17,7 @@ class Role(NamedTuple): """Class representing a role: creates immutable objects.""" role_id: UUID role_name: str - privileges: Iterable[Privilege] + privileges: tuple[Privilege, ...] def dictify(self) -> dict[str, Any]: """Return a dict representation of `Role` objects.""" @@ -44,7 +44,7 @@ def create_role( RETURNS: An immutable `gn3.auth.authorisation.roles.Role` object """ - role = Role(uuid4(), role_name, privileges) + role = Role(uuid4(), role_name, tuple(privileges)) cursor.execute( "INSERT INTO roles(role_id, role_name) VALUES (?, ?)", -- cgit 1.4.1