From b5e75c6f2e1bda65f799530de3acbb8a649e8d2d Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 26 Nov 2021 18:20:58 +0100 Subject: [PATCH] feat(api): fixed /accounts ambiguous tenant_id --- ee/api/chalicelib/core/users.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index ffbb56520..0f3254b71 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -266,8 +266,10 @@ def get(user_id, tenant_id): LEFT JOIN public.roles USING (role_id) WHERE users.user_id = %(userId)s - AND tenant_id = %(tenantId)s - AND deleted_at IS NULL + AND users.tenant_id = %(tenantId)s + AND roles.tenant_id = %(tenantId)s + AND users.deleted_at IS NULL + AND (roles.role_id IS NULL or roles.deleted_at IS NULL) LIMIT 1;""", {"userId": user_id, "tenantId": tenant_id}) )