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 support for identity verification providers list retrieving api. #671

Merged
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 @@ -50,7 +50,7 @@ public class IdvProvidersApi {

@Consumes({ "application/json" })
@Produces({ "application/json", "application/xml", })
@ApiOperation(value = "Add a new identity verification provider. ", notes = "This API provides the capability to add an identity verification provider. <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvpmgt/create <br> <b>Scope required:</b> <br> * internal_idvp_add ", response = IdVProviderResponse.class, authorizations = {
@ApiOperation(value = "Add a new identity verification provider. ", notes = "This API provides the capability to add an identity verification provider. <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvp/add <br> <b>Scope required:</b> <br> * internal_idvp_add ", response = IdVProviderResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

Expand All @@ -74,7 +74,7 @@ public Response addIdVProvider(@ApiParam(value = "This represents the identity p
@Path("/{idv-provider-id}")

@Produces({ "application/json" })
@ApiOperation(value = "Delete an identity verification provider by using the identity provider's ID. ", notes = "This API provides the capability to delete an identity verification provider by giving its ID. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvpmgt/delete <br> <b>Scope required:</b> <br> * internal_idvp_delete ", response = Void.class, authorizations = {
@ApiOperation(value = "Delete an identity verification provider by using the identity provider's ID. ", notes = "This API provides the capability to delete an identity verification provider by giving its ID. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvp/delete <br> <b>Scope required:</b> <br> * internal_idvp_delete ", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

Expand All @@ -98,7 +98,7 @@ public Response deleteIdVProvider(@ApiParam(value = "ID of the identity verifica
@Path("/{idv-provider-id}")

@Produces({ "application/json", "application/xml", })
@ApiOperation(value = "Retrieve identity verification provider by identity verification provider's ID ", notes = "This API provides the capability to retrieve the identity verification provider details by using its ID. <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvpmgt/view <br> <b>Scope required:</b> <br> * internal_idvp_view ", response = IdVProviderResponse.class, authorizations = {
@ApiOperation(value = "Retrieve identity verification provider by identity verification provider's ID ", notes = "This API provides the capability to retrieve the identity verification provider details by using its ID. <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvp/view <br> <b>Scope required:</b> <br> * internal_idvp_view ", response = IdVProviderResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

Expand All @@ -122,7 +122,7 @@ public Response getIdVProvider(@ApiParam(value = "ID of the identity verificatio


@Produces({ "application/json" })
@ApiOperation(value = "List identity verification providers. ", notes = "This API provides the capability to retrieve the list of identity verification providers.<br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvpmgt/view <br> <b>Scope required:</b> <br> * internal_idvp_view ", response = IdVProviderListResponse.class, authorizations = {
@ApiOperation(value = "List identity verification providers. ", notes = "This API provides the capability to retrieve the list of identity verification providers.<br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvp/view <br> <b>Scope required:</b> <br> * internal_idvp_view ", response = IdVProviderListResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

Expand All @@ -137,17 +137,17 @@ public Response getIdVProvider(@ApiParam(value = "ID of the identity verificatio
@ApiResponse(code = 500, message = "Server Error", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented", response = Error.class)
})
public Response getIdVProviders( @Valid@ApiParam(value = "Maximum number of records to return. ") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ") @QueryParam("offset") Integer offset) {
public Response getIdVProviders( @Valid@ApiParam(value = "Maximum number of records to return. ") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew' and 'eq' operations and also complex queries with 'and' operations. E.g. /idv-providers?filter=name+sw+onfido+and+isEnabled+eq+true ") @QueryParam("filter") String filter) {

return delegate.getIdVProviders(limit, offset );
return delegate.getIdVProviders(limit, offset, filter );
}

@Valid
@PUT
@Path("/{idv-provider-id}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Update an identity verification provider. ", notes = "This API provides the capability to update an identity verification provider <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvpmgt/update <br> <b>Scope required:</b> <br> * internal_idvp_update ", response = IdVProviderResponse.class, authorizations = {
@ApiOperation(value = "Update an identity verification provider. ", notes = "This API provides the capability to update an identity verification provider <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/idvp/update <br> <b>Scope required:</b> <br> * internal_idvp_update ", response = IdVProviderResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IdvProvidersApiService {

public Response getIdVProvider(String idvProviderId);

public Response getIdVProviders(Integer limit, Integer offset);
public Response getIdVProviders(Integer limit, Integer offset, String filter);

public Response updateIdVProviders(String idvProviderId, IdVProviderRequest idVProviderRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,27 @@ public IdVProviderResponse getIdVProvider(String idVProviderId) {
*/
public IdVProviderListResponse getIdVProviders(Integer limit, Integer offset) {

return getIdVProviders(limit, offset, null);
}

/**
* Get all identity verification providers with filtering.
*
* @param limit Limit per page.
* @param offset Offset value.
* @return Identity verification providers.
*/
public IdVProviderListResponse getIdVProviders(Integer limit, Integer offset, String filter) {

int tenantId = getTenantId();
try {
IdVProviderManager idVProviderManager = IdentityVerificationServiceHolder.getIdVProviderManager();
int totalResults = idVProviderManager.getCountOfIdVProviders(tenantId);
int totalResults = idVProviderManager.getCountOfIdVProviders(tenantId, filter);

IdVProviderListResponse idVProviderListResponse = new IdVProviderListResponse();

if (totalResults > 0) {
List<IdVProvider> idVProviders = idVProviderManager.getIdVProviders(limit, offset, tenantId);
List<IdVProvider> idVProviders = idVProviderManager.getIdVProviders(limit, offset, filter, tenantId);

if (CollectionUtils.isNotEmpty(idVProviders)) {
List<IdVProviderResponse> idVProvidersList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public Response getIdVProvider(String idvProviderId) {
}

@Override
public Response getIdVProviders(Integer limit, Integer offset) {
public Response getIdVProviders(Integer limit, Integer offset, String filter) {

IdVProviderListResponse idVProviderListResponse = idVProviderService.getIdVProviders(limit, offset);
IdVProviderListResponse idVProviderListResponse = idVProviderService.getIdVProviders(limit, offset, filter);
return Response.ok().entity(idVProviderListResponse).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ paths:
parameters:
- $ref: '#/components/parameters/limitQueryParam'
- $ref: '#/components/parameters/offsetQueryParam'
- $ref: '#/components/parameters/filterQueryParam'
responses:
'200':
description: Successful Response
Expand Down Expand Up @@ -317,6 +318,16 @@ components:
schema:
type: integer
format: int32
filterQueryParam:
in: query
name: filter
required: false
description: >
Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew'
and 'eq' operations and also complex queries with 'and' operations. E.g.
/idv-providers?filter=name+sw+onfido+and+isEnabled+eq+true
schema:
type: string
idVPQueryParam:
in: query
name: idvProviderid
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
<!--<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>-->

<tenant.resource.manager.version>1.5.55</tenant.resource.manager.version>
<identity.verification.version>1.0.11</identity.verification.version>
<identity.verification.version>1.0.12</identity.verification.version>

<!-- Organization management core Version -->
<org.wso2.carbon.identity.organization.management.core.version>1.1.12
Expand Down
Loading