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

Add filtering for list discovery attributes of organizations API #513

Merged
merged 1 commit into from
Oct 22, 2023
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 @@ -84,7 +84,6 @@
import static org.wso2.carbon.identity.api.server.organization.management.v1.constants.OrganizationManagementEndpointConstants.ASC_SORT_ORDER;
import static org.wso2.carbon.identity.api.server.organization.management.v1.constants.OrganizationManagementEndpointConstants.DESC_SORT_ORDER;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ERROR_BUILDING_PAGINATED_RESPONSE_URL;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_FILTERING_NOT_IMPLEMENTED;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_PAGINATION_PARAMETER_NEGATIVE_LIMIT;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_EMPTY_REQUEST_BODY;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_REQUEST_BODY;
Expand Down Expand Up @@ -474,17 +473,17 @@ public Response deleteOrganizationDiscoveryAttributes(String organizationId) {
/**
* Returns the discovery attributes of the organizations.
*
* @param filter The filter string. **Not supported at the moment.**
* @param filter The filter string.
* @param offset The offset to be used with the limit parameter. **Not supported at the moment.**
* @param limit The items per page. **Not supported at the moment.**
* @return The discovery attributes of the organizations in the hierarchy under the root organization.
*/
public Response getOrganizationsDiscoveryAttributes(String filter, Integer offset, Integer limit) {

handleNotImplementedCapabilities(filter, offset, limit);
handleNotImplementedCapabilities(offset, limit);
try {
List<OrganizationDiscovery> organizationsDiscoveryAttributes =
getOrganizationDiscoveryManager().getOrganizationsDiscoveryAttributes();
getOrganizationDiscoveryManager().getOrganizationsDiscoveryAttributes(filter);
OrganizationsDiscoveryResponse response = new OrganizationsDiscoveryResponse();
for (OrganizationDiscovery organizationDiscovery : organizationsDiscoveryAttributes) {
OrganizationDiscoveryResponse organizationDiscoveryResponse = new OrganizationDiscoveryResponse();
Expand Down Expand Up @@ -868,7 +867,7 @@ private List<OrgDiscoveryAttribute> getOrgDiscoveryAttributesFromPutRequest(Orga
}).collect(Collectors.toList());
}

private void handleNotImplementedCapabilities(String filter, Integer offset, Integer limit) {
private void handleNotImplementedCapabilities(Integer offset, Integer limit) {

if (limit != null || offset != null) {
Error error = OrganizationManagementEndpointUtil.getError(
Expand All @@ -877,13 +876,6 @@ private void handleNotImplementedCapabilities(String filter, Integer offset, Int
ERROR_CODE_PAGINATION_NOT_IMPLEMENTED.getDescription());
throw new OrganizationManagementEndpointException(Response.Status.NOT_IMPLEMENTED, error);
}
if (filter != null) {
Error error = OrganizationManagementEndpointUtil.getError(
ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getCode(),
ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getMessage(),
ERROR_CODE_FILTERING_NOT_IMPLEMENTED.getDescription());
throw new OrganizationManagementEndpointException(Response.Status.NOT_IMPLEMENTED, error);
}
}

private OrganizationMetadata getOrganizationMetadataResponse(Organization organization, List<OrgDiscoveryAttribute>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
</org.wso2.carbon.identity.organization.management.core.version.range>

<!-- Organization management service Version -->
<org.wso2.carbon.identity.organization.management.version>1.3.85
<org.wso2.carbon.identity.organization.management.version>1.3.88
</org.wso2.carbon.identity.organization.management.version>

<!-- Unit test versions -->
Expand Down
Loading