Skip to content

Commit

Permalink
Merge pull request #12590 from nisan-abeywickrama/admin-search
Browse files Browse the repository at this point in the history
Add support to search applications by owner or name
  • Loading branch information
RakhithaRR authored Oct 3, 2024
2 parents 1e7da75 + b472c16 commit 9c560ad
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public class SQLConstantOracle extends SQLConstants{
" SUB.TENANT_ID = ? "+
" And "+
" ( SUB.CREATED_BY like ?"+
" AND APP.NAME like ?"+
" OR APP.NAME like ?"+
" )) a WHERE r BETWEEN ?+1 AND ?"+
" ) "+
" ORDER BY $1 $2 ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public class SQLConstantPostgreSQL extends SQLConstants{
" SUB.TENANT_ID = ? "+
" And "+
" ( SUB.CREATED_BY like ?"+
" AND APP.NAME like ?"+
" OR APP.NAME like ?"+
" ) ORDER BY $1 $2 " +
" offset ? limit ? ";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public class SQLConstantsDB2 extends SQLConstants{
" SUB.TENANT_ID = ? "+
" And "+
" ( SUB.CREATED_BY like ?"+
" AND APP.NAME like ?"+
" OR APP.NAME like ?"+
" )) a ) " +
" ORDER BY $1 $2 limit ? , ? ";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public class SQLConstantsH2MySQL extends SQLConstants{
" SUB.TENANT_ID = ? "+
" And "+
" ( SUB.CREATED_BY like ?"+
" AND APP.NAME like ?"+
" OR APP.NAME like ?"+
" ) ORDER BY $1 $2 " +
" limit ? , ? ";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public class SQLConstantsMSSQL extends SQLConstants{
" SUB.TENANT_ID = ?"+
" And "+
" ( SUB.CREATED_BY like ?"+
" AND APP.NAME like ?"+
" OR APP.NAME like ?"+
" )) a " +
" )" +
" ORDER BY $1 $2 OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
Expand Down
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 9c560ad

Please sign in to comment.