From a99da4f8e4c6e536fb859c1b31fa8caf6bb71737 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Thu, 22 Dec 2022 10:22:08 +0100 Subject: [PATCH] fix: user queries (#4920) --- internal/api/grpc/management/user_converter.go | 2 +- internal/query/user.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/api/grpc/management/user_converter.go b/internal/api/grpc/management/user_converter.go index 96a26f6181..525eba9d89 100644 --- a/internal/api/grpc/management/user_converter.go +++ b/internal/api/grpc/management/user_converter.go @@ -373,7 +373,7 @@ func ListUserMembershipsRequestToModel(ctx context.Context, req *mgmt_pb.ListUse if err != nil { return nil, err } - ownerQuery, err := query.NewMembershipResourceOwnerQuery(authz.GetCtxData(ctx).OrgID) + ownerQuery, err := query.NewMembershipResourceOwnersSearchQuery(authz.GetInstance(ctx).InstanceID(), authz.GetCtxData(ctx).OrgID) if err != nil { return nil, err } diff --git a/internal/query/user.go b/internal/query/user.go index 7d722f14d4..6d3b39fda1 100644 --- a/internal/query/user.go +++ b/internal/query/user.go @@ -387,7 +387,7 @@ func (q *Queries) GetHumanProfile(ctx context.Context, userID string, withOwnerR UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), } if !withOwnerRemoved { - addUserWithoutOwnerRemoved(eq) + eq[UserOwnerRemovedCol.identifier()] = false } stmt, args, err := query.Where(eq).ToSql() if err != nil { @@ -411,7 +411,7 @@ func (q *Queries) GetHumanEmail(ctx context.Context, userID string, withOwnerRem UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), } if !withOwnerRemoved { - addUserWithoutOwnerRemoved(eq) + eq[UserOwnerRemovedCol.identifier()] = false } stmt, args, err := query.Where(eq).ToSql() if err != nil { @@ -435,7 +435,7 @@ func (q *Queries) GetHumanPhone(ctx context.Context, userID string, withOwnerRem UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), } if !withOwnerRemoved { - addUserWithoutOwnerRemoved(eq) + eq[UserOwnerRemovedCol.identifier()] = false } stmt, args, err := query.Where(eq).ToSql() if err != nil { @@ -562,7 +562,7 @@ func (q *Queries) IsUserUnique(ctx context.Context, username, email, resourceOwn } eq := sq.Eq{UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID()} if !withOwnerRemoved { - addUserWithoutOwnerRemoved(eq) + eq[UserOwnerRemovedCol.identifier()] = false } stmt, args, err := query.Where(eq).ToSql() if err != nil {