bcgov / api-services-portal

API Services Portal provides a multi-tenant frontend integrating API Gateway and Authorization services from Kong CE and Keycloak.
https://api.gov.bc.ca
Apache License 2.0
22 stars 7 forks source link

Consumers appearing twice #843

Closed ikethecoder closed 1 year ago

ikethecoder commented 1 year ago

API Services Portal Issue

User Story

As an Access Manager,
I want to be able to filter a list of consumers, find a consumer and get detail on a consumer's access to a product
so that I can manage access effectively .

Test Case

ENV

TESTCASE

EXPECTED

ACTUAL

ERROR

Notes

Additional Scope of Change

chrsamp commented 1 year ago

This is occurring for the LOC team and is possibly impacting the results returned on the namespace report spreadsheet

Elson9 commented 1 year ago

A couple examples: dbcols, blueinc. Alix is concerned that some people have access that shouldn't. Sort by name not working properly.

ikethecoder commented 1 year ago

Recreating the issue in Test - using moh-proto namespace:

Consumer: After requesting access to the Pharmanet API, I received a new consumer "535C4DF2-070C92957B1". Then took that consumer and manually created a new "ServiceAccess" record in postgres to replicate a production migration of legacy consumers.

keystonejs=# insert into "ServiceAccess" (name, namespace, consumer, application, "productEnvironment", active, "aclEnabled", "consumerType") values ('535C4DF2-070C92957B1 for sandbox', 'moh-proto', 16885, 401, 428, false, false, 'client');
INSERT 0 1
keystonejs=# select * from "ServiceAccess" where name = '535C4DF2-070C92957B1 for sandbox';
keystonejs=# update "ServiceAccess" set "updatedAt_utc" = '2023-09-21 22:35:41.667', "createdAt_utc" = '2023-09-21 22:35:41.667', "updatedAt_offset" = '+00:00', "createdAt_offset" = '+00:00' where id = 1050;
UPDATE 1

As a result of adding another "ServiceAccess" record for the particular consumer, two records now appear on the Consumers page.

Private Zenhub Image

Elson9 commented 1 year ago

Steps to reproduce:

Connecting to Docker database: docker exec -it kong-db psql -U postgres -W postgres \c keystonejs