Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: hide those idp archived user (#4624)

boojack2ff11e52260d
diff --git a/backend/store/principal.go b/backend/store/principal.go
index dee7594eb6..f1623a96d1 100644
--- a/backend/store/principal.go
+++ b/backend/store/principal.go
@@ -224,6 +224,8 @@ func (s *Store) GetUserByEmail(ctx context.Context, email string) (*UserMessage,
// GetUserByEmailV2 gets an instance of Principal.
func (s *Store) listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMessage, error) {
where, args := []string{"TRUE"}, []interface{}{}
+ // Do not to select those archived IdP user.
+ where, args = append(where, fmt.Sprintf("(principal.idp_id IS NULL OR idp.row_status = $%d)", len(args)+1)), append(args, api.Normal)
if v := find.ID; v != nil {
where, args = append(where, fmt.Sprintf("principal.id = $%d", len(args)+1)), append(args, *v)
}