diff options
Diffstat (limited to 'gn_auth/auth/authorisation')
-rw-r--r-- | gn_auth/auth/authorisation/resources/groups/models.py | 3 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/resources/views.py | 2 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/users/admin/views.py | 3 | ||||
-rw-r--r-- | gn_auth/auth/authorisation/users/models.py | 4 |
4 files changed, 4 insertions, 8 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/models.py b/gn_auth/auth/authorisation/resources/groups/models.py index 3feefa6..03a93b6 100644 --- a/gn_auth/auth/authorisation/resources/groups/models.py +++ b/gn_auth/auth/authorisation/resources/groups/models.py @@ -276,8 +276,7 @@ def group_users(conn: db.DbConnection, group_id: UUID) -> Iterable[User]: {"group_id": str(group_id)}) results = cursor.fetchall() - return (User(UUID(row["user_id"]), row["email"], row["name"]) - for row in results) + return (User.from_sqlite3_row(row) for row in results) @authorised_p( diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py index 0200222..c481ef9 100644 --- a/gn_auth/auth/authorisation/resources/views.py +++ b/gn_auth/auth/authorisation/resources/views.py @@ -172,7 +172,7 @@ def resource_users(resource_id: uuid.UUID): def __organise_users_n_roles__(users_n_roles, row): user_id = uuid.UUID(row["user_id"]) user = users_n_roles.get(user_id, {}).get( - "user", User(user_id, row["email"], row["name"])) + "user", User.from_sqlite3_row(row)) role = Role( uuid.UUID(row["role_id"]), row["role_name"], bool(int(row["user_editable"])), tuple()) diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py index 73e808a..8ca1e51 100644 --- a/gn_auth/auth/authorisation/users/admin/views.py +++ b/gn_auth/auth/authorisation/users/admin/views.py @@ -189,8 +189,7 @@ def register_client(): with db.cursor(conn) as cursor: cursor.execute("SELECT * FROM users") return tuple( - User(uuid.UUID(row["user_id"]), row["email"], row["name"]) - for row in cursor.fetchall()) + User.from_sqlite3_row(row) for row in cursor.fetchall()) if request.method == "GET": return render_template( "admin/register-client.html", diff --git a/gn_auth/auth/authorisation/users/models.py b/gn_auth/auth/authorisation/users/models.py index 8b47fc1..bde2e33 100644 --- a/gn_auth/auth/authorisation/users/models.py +++ b/gn_auth/auth/authorisation/users/models.py @@ -17,9 +17,7 @@ def list_users(conn: db.DbConnection) -> tuple[User, ...]: """List out all users.""" with db.cursor(conn) as cursor: cursor.execute("SELECT * FROM users") - return tuple( - User(uuid.UUID(row["user_id"]), row["email"], row["name"]) - for row in cursor.fetchall()) + return tuple(User.from_sqlite3_row(row) for row in cursor.fetchall()) def __build_resource_roles__(rows): def __build_roles__(roles, row): |