From dd2deadee577cdc906578fef1f6a88bb40cd444b Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Tue, 7 Nov 2023 13:48:47 +0100 Subject: [PATCH] Api v1.15.0 (#1617) * refactor(chalice): enhanced delete member logic --- api/chalicelib/core/users.py | 8 ++++---- ee/api/chalicelib/core/users.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/chalicelib/core/users.py b/api/chalicelib/core/users.py index 3e5758004..c2503db6d 100644 --- a/api/chalicelib/core/users.py +++ b/api/chalicelib/core/users.py @@ -431,14 +431,14 @@ def delete_member(user_id, tenant_id, id_to_delete): with pg_client.PostgresClient() as cur: cur.execute( cur.mogrify(f"""UPDATE public.users - SET deleted_at = timezone('utc'::text, now()) + SET deleted_at = timezone('utc'::text, now()), + jwt_iat= NULL, jwt_refresh_jti= NULL, + jwt_refresh_iat= NULL WHERE user_id=%(user_id)s;""", {"user_id": id_to_delete})) cur.execute( cur.mogrify(f"""UPDATE public.basic_authentication - SET password= NULL, jwt_iat= NULL, - jwt_refresh_jti= NULL, jwt_refresh_iat= NULL, - password= NULL, invitation_token= NULL, + SET password= NULL, invitation_token= NULL, invited_at= NULL, changed_at= NULL, change_pwd_expire_at= NULL, change_pwd_token= NULL WHERE user_id=%(user_id)s;""", diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index 79aabaafe..1e998740e 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -490,14 +490,14 @@ def delete_member(user_id, tenant_id, id_to_delete): with pg_client.PostgresClient() as cur: cur.execute( cur.mogrify(f"""UPDATE public.users - SET deleted_at = timezone('utc'::text, now()), role_id=NULL + SET deleted_at = timezone('utc'::text, now()), role_id=NULL, + jwt_iat= NULL, jwt_refresh_jti= NULL, + jwt_refresh_iat= NULL WHERE user_id=%(user_id)s AND tenant_id=%(tenant_id)s;""", {"user_id": id_to_delete, "tenant_id": tenant_id})) cur.execute( cur.mogrify(f"""UPDATE public.basic_authentication - SET password=NULL, jwt_iat= NULL, - jwt_refresh_jti= NULL, jwt_refresh_iat= NULL, - password= NULL, invitation_token= NULL, + SET password=NULL, invitation_token= NULL, invited_at= NULL, changed_at= NULL, change_pwd_expire_at= NULL, change_pwd_token= NULL WHERE user_id=%(user_id)s;""",