Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce excludeSystemPortals query param #711

Merged
merged 6 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,10 @@ public Response getAllApplicationTemplates( @Valid@ApiParam(value = "Maximum
@ApiResponse(code = 500, message = "Server Error", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented", response = Error.class)
})
public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal <br> /applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'templateVersion', 'clientId', 'issuer', 'applicationEnabled' and 'associatedRoles.allowedAudience' attributes. /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience ") @QueryParam("attributes") String attributes) {
public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal <br> /applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'templateVersion', 'clientId', 'issuer', 'applicationEnabled' and 'associatedRoles.allowedAudience' attributes. /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience ") @QueryParam("attributes") String attributes, @Valid@ApiParam(value = "Specifies whether to include or exclude system portals in the response. /applications?excludeSystemPortals=true ") @QueryParam("excludeSystemPortals") Boolean excludeSystemPortals) {

return delegate.getAllApplications(limit, offset, filter, sortOrder, sortBy, attributes );
return delegate.getAllApplications(limit, offset, filter, sortOrder, sortBy, attributes,
excludeSystemPortals);
}

@Valid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -90,6 +90,8 @@ public interface ApplicationsApiService {

public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String attributes);

public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String attributes, Boolean excludeSystemPortals);

public Response getApplication(String applicationId);

public Response getApplicationTemplate(String templateId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,17 @@ public class ServerApplicationManagementService {
@Autowired
private ServerApplicationMetadataService applicationMetadataService;

@Deprecated
public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String filter, String sortOrder,
String sortBy, String requiredAttributes) {

return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, false);
}

public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String filter, String sortOrder,
String sortBy, String requiredAttributes,
Boolean excludeSystemPortals) {

handleNotImplementedCapabilities(sortOrder, sortBy);
String tenantDomain = ContextLoader.getTenantDomainFromContext();

Expand All @@ -277,10 +285,10 @@ public ApplicationListResponse getAllApplications(Integer limit, Integer offset,
String username = ContextLoader.getUsernameFromContext();
try {
int totalResults = getApplicationManagementService()
.getCountOfApplications(tenantDomain, username, filter);
.getCountOfApplications(tenantDomain, username, filter, excludeSystemPortals);

ApplicationBasicInfo[] filteredAppList = getApplicationManagementService()
.getApplicationBasicInfo(tenantDomain, username, filter, offset, limit);
.getApplicationBasicInfo(tenantDomain, username, filter, offset, limit, excludeSystemPortals);
int resultsInCurrentPage = filteredAppList.length;

List<String> requestedAttributeList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,20 @@ public class ApplicationsApiServiceImpl implements ApplicationsApiService {
@Autowired
private ServerApplicationSharingService applicationSharingService;

@Deprecated
@Override
public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy,
String requiredAttributes) {

ApplicationListResponse listResponse = applicationManagementService
.getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes);
return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, false);
}

@Override
public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy,
String requiredAttributes, Boolean excludeSystemPortals) {

ApplicationListResponse listResponse = applicationManagementService.getAllApplications(limit, offset, filter,
sortOrder, sortBy, requiredAttributes, Boolean.TRUE.equals(excludeSystemPortals));
return Response.ok().entity(listResponse).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ paths:
- $ref: '#/components/parameters/sortOrderQueryParam'
- $ref: '#/components/parameters/sortByQueryParam'
- $ref: '#/components/parameters/attributesQueryParam'
- $ref: '#/components/parameters/excludeSystemPortalsQueryParam'
responses:
'200':
description: OK
Expand Down Expand Up @@ -2701,6 +2702,17 @@ components:
/applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience
schema:
type: string
excludeSystemPortalsQueryParam:
JeethJJ marked this conversation as resolved.
Show resolved Hide resolved
in: query
name: excludeSystemPortals
required: false
description: |
Specifies whether to include or exclude system portals in the response.
Default will be treated as false if parameter is not preset in the request.

/applications?excludeSystemPortals=true
schema:
type: boolean
exportSecretsQueryParam:
in: query
name: exportSecrets
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
<org.apache.felix.annotations.version>1.2.4</org.apache.felix.annotations.version>
<identity.governance.version>1.10.6</identity.governance.version>
<carbon.identity.framework.version>7.5.46</carbon.identity.framework.version>
<carbon.identity.framework.version>7.5.69</carbon.identity.framework.version>
<maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>
Expand Down
Loading