aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-31 09:54:42 -0500
committerFrederick Muriuki Muriithi2025-07-31 09:54:58 -0500
commit1f3e3dc7fc03048e046911ead611afd2d6e1146f (patch)
tree6d64cc696c5d18f968789bef5b215db84c045c4d
parent586602686633d64244c4a81988e69437ff27d88e (diff)
downloadgn-auth-1f3e3dc7fc03048e046911ead611afd2d6e1146f.tar.gz
Fix query to remove user from group.
-rw-r--r--gn_auth/auth/authorisation/resources/groups/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/models.py b/gn_auth/auth/authorisation/resources/groups/models.py
index f067135..8b1df90 100644
--- a/gn_auth/auth/authorisation/resources/groups/models.py
+++ b/gn_auth/auth/authorisation/resources/groups/models.py
@@ -344,8 +344,8 @@ def remove_user_from_group(
"""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"),
+ "DELETE FROM group_users "
+ "WHERE group_id=:group_id AND user_id=:user_id",
{"group_id": str(group.group_id), "user_id": str(user.user_id)})
assign_user_role_by_name(cursor,
user,