about summary refs log tree commit diff
path: root/gn_auth/auth/authorisation/resources
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authorisation/resources')
-rw-r--r--gn_auth/auth/authorisation/resources/groups/views.py4
-rw-r--r--gn_auth/auth/authorisation/resources/models.py5
-rw-r--r--gn_auth/auth/authorisation/resources/views.py2
3 files changed, 6 insertions, 5 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py
index 96cfb67..26534fc 100644
--- a/gn_auth/auth/authorisation/resources/groups/views.py
+++ b/gn_auth/auth/authorisation/resources/groups/views.py
@@ -59,7 +59,7 @@ def create_group():
             new_group = _create_group(
                 conn, group_name, user, request.form.get("group_description"))
             return jsonify({
-                **dictify(new_group), "group_leader": dictify(user)
+                **dictify(new_group), "group_leader": asdict(user)
             })
 
 @groups.route("/members/<uuid:group_id>", methods=["GET"])
@@ -71,7 +71,7 @@ def group_members(group_id: uuid.UUID) -> Response:
         ## Check that user has appropriate privileges and remove the pylint disable above
         with db.connection(db_uri) as conn:
             return jsonify(tuple(
-                dictify(user) for user in _group_users(conn, group_id)))
+                asdict(user) for user in _group_users(conn, group_id)))
 
 @groups.route("/requests/join/<uuid:group_id>", methods=["POST"])
 @require_oauth("profile group")
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index 3693ad1..7ebf5f7 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -1,4 +1,5 @@
 """Handle the management of resources."""
+from dataclasses import asdict
 from uuid import UUID, uuid4
 from functools import reduce, partial
 from sqlite3 import Row
@@ -341,7 +342,7 @@ def assign_resource_user(
              str(resource.resource_id)))
         return {
             "resource": dictify(resource),
-            "user": dictify(user),
+            "user": asdict(user),
             "role": dictify(role),
             "description": (
                 f"The user '{user.name}'({user.email}) was assigned the "
@@ -365,7 +366,7 @@ def unassign_resource_user(
              str(resource.resource_id)))
         return {
             "resource": dictify(resource),
-            "user": dictify(user),
+            "user": asdict(user),
             "role": dictify(role),
             "description": (
                 f"The user '{user.name}'({user.email}) had the "
diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py
index c5da257..8976dfa 100644
--- a/gn_auth/auth/authorisation/resources/views.py
+++ b/gn_auth/auth/authorisation/resources/views.py
@@ -193,9 +193,9 @@ def resource_users(resource_id: uuid.UUID):
                 "users.")
         results = (
             {
-                "user": dictify(row["user"]),
                 "user_group": dictify(row["user_group"]),
                 "roles": tuple(dictify(role) for role in row["roles"])
+                "user": asdict(row["user"]),
             } for row in (
                 user_row for user_id, user_row
                 in with_db_connection(__the_users__).items()))