about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-30 12:05:36 -0500
committerFrederick Muriuki Muriithi2025-07-30 12:54:54 -0500
commit75bbf11386457e2f366e3c38c4e8d729b542de55 (patch)
tree6d4917133c030ba6a905036dbdccccbb6bdd37ad
parentb146cac36aea12eb774205eade124980af48c1d5 (diff)
downloadgn-auth-75bbf11386457e2f366e3c38c4e8d729b542de55.tar.gz
Fix linting errors and typos.
-rw-r--r--gn_auth/auth/authorisation/resources/groups/models.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/models.py b/gn_auth/auth/authorisation/resources/groups/models.py
index 18210e3..f067135 100644
--- a/gn_auth/auth/authorisation/resources/groups/models.py
+++ b/gn_auth/auth/authorisation/resources/groups/models.py
@@ -335,16 +335,21 @@ def resource_from_group(conn: db.DbConnection, the_group: Group) -> Resource:
         return results[0]
 
 
-def remove_user_from_group(conn: db.DbConnection, the_group: Group, user: User):
-    """Add `user` to `the_group` as a member."""
+def remove_user_from_group(
+        conn: db.DbConnection,
+        group: Group,
+        user: User,
+        grp_resource: Resource
+):
+    """Add `user` to `group` as a member."""
     with db.cursor(conn) as cursor:
         cursor.execute(
             ("INSERT INTO group_users VALUES (:group_id, :user_id) "
              "ON CONFLICT (group_id, user_id) DO NOTHING"),
-            {"group_id": str(the_group.group_id), "user_id": str(user.user_id)})
-        assign_user_role_by_name(conn,
+            {"group_id": str(group.group_id), "user_id": str(user.user_id)})
+        assign_user_role_by_name(cursor,
                                  user,
-                                 resource_from_group(the_group).group_id,
+                                 grp_resource.resource_id,
                                  "group-creator")