Skip to content

Commit

Permalink
Merge pull request #513 from dewniMW/fil
Browse files Browse the repository at this point in the history
Add filtering for list discovery attributes of organizations API
  • Loading branch information
dewniMW authored Oct 22, 2023
2 parents 94c3713 + 1901d67 commit 8ae4faf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
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

0 comments on commit 8ae4faf

Please sign in to comment.