Skip to content

Commit

Permalink
Update search functionality to filter applications based on the logge…
Browse files Browse the repository at this point in the history
…d-in user's tenant
  • Loading branch information
nisan-abeywickrama committed Oct 3, 2024
1 parent 8f31338 commit b472c16
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,8 @@ public Response applicationsGet(String user, Integer limit, Integer offset, Stri
boolean migrationMode = Boolean.getBoolean(RestApiConstants.MIGRATION_MODE);
int allApplicationsCount = 0;
if (!migrationMode) { // normal non-migration flow
if (!MultitenantUtils.getTenantDomain(user).equals(RestApiCommonUtil.getLoggedInUserTenantDomain())) {
String errorMsg = "User " + user + " is not available for the current tenant domain";
log.error(errorMsg);
return Response.status(Response.Status.FORBIDDEN).entity(errorMsg).build();
}
APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(user);

// If no user is passed, get the applications for the tenant (not only for the user)
APIAdmin apiAdmin = new APIAdminImpl();
int tenantId = APIUtil.getTenantId(user);
int tenantId = APIUtil.getTenantId(RestApiCommonUtil.getLoggedInUsername());
allMatchedApps = apiAdmin.getApplicationsWithPagination(user, givenUser, tenantId, limit, offset,
applicationName, sortBy, sortOrder);
allApplicationsCount = apiAdmin.getApplicationsCount(tenantId, givenUser, applicationName);
Expand Down

0 comments on commit b472c16

Please sign in to comment.