aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/resources/views.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-05-30 12:03:38 -0500
committerFrederick Muriuki Muriithi2024-06-03 10:02:08 -0500
commit7c0ee01c1d134cbee0a2c8243dd55e4eeaaa5f7c (patch)
treecaeb61fab877b7b344608af4a55b36a18b3283c2 /gn_auth/auth/authorisation/resources/views.py
parentd2e9e9afde6d01bca49e5173282ac318c37460e0 (diff)
downloadgn-auth-7c0ee01c1d134cbee0a2c8243dd55e4eeaaa5f7c.tar.gz
Move user creation from db resultset into static method
Creation of a User object from the database resultset will mostly be the same. This commit moves the repetitive code into a static method that can be called wherever we need it. This improves maintainability, since we only ever need to do an update in one place now.
Diffstat (limited to 'gn_auth/auth/authorisation/resources/views.py')
-rw-r--r--gn_auth/auth/authorisation/resources/views.py2
1 files changed, 1 insertions, 1 deletions
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())