about summary refs log tree commit diff
path: root/gn3/auth/authorisation/privileges.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/auth/authorisation/privileges.py')
-rw-r--r--gn3/auth/authorisation/privileges.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gn3/auth/authorisation/privileges.py b/gn3/auth/authorisation/privileges.py
index 09439ad..9e66bda 100644
--- a/gn3/auth/authorisation/privileges.py
+++ b/gn3/auth/authorisation/privileges.py
@@ -3,13 +3,14 @@ from uuid import UUID
 from typing import Iterable, NamedTuple
 
 from gn3.auth import db
+from gn3.auth.authentication.users import User
 
 class Privilege(NamedTuple):
     """Class representing a privilege: creates immutable objects."""
     privilege_id: UUID
     privilege_name: str
 
-def user_privileges(conn: db.DbConnection, user_id: UUID) -> Iterable[Privilege]:
+def user_privileges(conn: db.DbConnection, user: User) -> Iterable[Privilege]:
     """Fetch the user's privileges from the database."""
     with db.cursor(conn) as cursor:
         cursor.execute(
@@ -18,7 +19,7 @@ def user_privileges(conn: db.DbConnection, user_id: UUID) -> Iterable[Privilege]
              "INNER JOIN role_privileges AS rp ON ur.role_id=rp.role_id "
              "INNER JOIN privileges AS p ON rp.privilege_id=p.privilege_id "
              "WHERE ur.user_id=?"),
-            (str(user_id),))
+            (str(user.user_id),))
         results = cursor.fetchall()
 
     return (Privilege(UUID(row[0]), row[1]) for row in results)