about summary refs log tree commit diff
path: root/gn_auth/auth/authorisation/resources/groups/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authorisation/resources/groups/models.py')
-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")