aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/resources/groups/views.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-03-12 00:05:17 +0300
committerMunyoki Kilyungi2024-03-13 10:29:02 +0300
commit3ac8cc38768bf3aca1ecc75db094bcb97b36cce7 (patch)
tree50817be04a126fe62b390d9d6a127408af1b72f4 /gn_auth/auth/authorisation/resources/groups/views.py
parent7e11ddbbdd6ddfa28367c02d0a3a7f3932c369ae (diff)
downloadgn-auth-3ac8cc38768bf3aca1ecc75db094bcb97b36cce7.tar.gz
Define GroupRole using frozen dataclass.
* gn_auth/auth/authorisation/resources/groups/models.py: Import dataclasses.asdict. Remove dictify import. (GroupRole): Use frozen dataclass. (GroupRole.dictify): Replace dictify(...) with self.role.dictify(). * gn_auth/auth/authorisation/resources/groups/views.py: (group_roles): Replace dictify with asdict. (view_group_role): Ditto. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn_auth/auth/authorisation/resources/groups/views.py')
-rw-r--r--gn_auth/auth/authorisation/resources/groups/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py
index b655a0f..8b471ff 100644
--- a/gn_auth/auth/authorisation/resources/groups/views.py
+++ b/gn_auth/auth/authorisation/resources/groups/views.py
@@ -308,7 +308,7 @@ def group_roles():
tuple()))
for row in cursor.fetchall())
return jsonify(tuple(
- dictify(role) for role in with_db_connection(__list_roles__)))
+ asdict(role) for role in with_db_connection(__list_roles__)))
@groups.route("/privileges", methods=["GET"])
@require_oauth("profile group")
@@ -384,7 +384,7 @@ def view_group_role(group_role_id: uuid.UUID):
raise AuthorisationError(
"A user without a group cannot view group roles.")
return group_role_by_id(conn, group, group_role_id)
- return jsonify(dictify(with_db_connection(__group_role__)))
+ return jsonify(asdict(with_db_connection(__group_role__)))
def __add_remove_priv_to_from_role__(conn: db.DbConnection,
group_role_id: uuid.UUID,