use of org.wso2.charon3.core.protocol.endpoints.UserResourceManager in project charon by wso2.
the class UserResource method getUsersByPost.
@POST
@Path("/.search")
@Produces({ "application/json", "application/scim+json" })
@Consumes("application/scim+json")
@ApiOperation(value = "Return users according to the filter, sort and pagination parameters", notes = "Returns HTTP 404 if the users are not found.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Valid users are found"), @ApiResponse(code = 404, message = "Valid users are not found") })
public Response getUsersByPost(String resourceString) throws FormatNotSupportedException, CharonException {
try {
// obtain the user store manager
UserManager userManager = DefaultCharonManager.getInstance().getUserManager();
// create charon-SCIM user resource manager and hand-over the request.
UserResourceManager userResourceManager = new UserResourceManager();
SCIMResponse scimResponse = userResourceManager.listWithPOST(resourceString, userManager);
return buildResponse(scimResponse);
} catch (CharonException e) {
throw new CharonException(e.getDetail(), e);
}
}
use of org.wso2.charon3.core.protocol.endpoints.UserResourceManager in project charon by wso2.
the class UserResource method getUser.
@GET
@Path("/{id}")
@Produces({ "application/json", "application/scim+json" })
@ApiOperation(value = "Return the user with the given id", notes = "Returns HTTP 200 if the user is found.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Valid user is found"), @ApiResponse(code = 404, message = "Valid user is not found") })
public Response getUser(@ApiParam(value = SCIMProviderConstants.ID_DESC, required = true) @PathParam(SCIMProviderConstants.ID) String id, @ApiParam(value = SCIMProviderConstants.ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.ATTRIBUTES) String attribute, @ApiParam(value = SCIMProviderConstants.EXCLUDED_ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.EXCLUDE_ATTRIBUTES) String excludedAttributes) throws FormatNotSupportedException, CharonException {
try {
// obtain the user store manager
UserManager userManager = DefaultCharonManager.getInstance().getUserManager();
// create charon-SCIM user endpoint and hand-over the request.
UserResourceManager userResourceManager = new UserResourceManager();
SCIMResponse scimResponse = userResourceManager.get(id, userManager, attribute, excludedAttributes);
// appropriately.
return buildResponse(scimResponse);
} catch (CharonException e) {
throw new CharonException(e.getDetail(), e);
}
}
use of org.wso2.charon3.core.protocol.endpoints.UserResourceManager in project charon by wso2.
the class UserResource method getUser.
@GET
@Produces({ "application/json", "application/scim+json" })
@ApiOperation(value = "Return users according to the filter, sort and pagination parameters", notes = "Returns HTTP 404 if the users are not found.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Valid users are found"), @ApiResponse(code = 404, message = "Valid users are not found") })
public Response getUser(@ApiParam(value = SCIMProviderConstants.ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.ATTRIBUTES) String attribute, @ApiParam(value = SCIMProviderConstants.EXCLUDED_ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.EXCLUDE_ATTRIBUTES) String excludedAttributes, @ApiParam(value = SCIMProviderConstants.FILTER_DESC, required = false) @QueryParam(SCIMProviderConstants.FILTER) String filter, @ApiParam(value = SCIMProviderConstants.START_INDEX_DESC, required = false) @QueryParam(SCIMProviderConstants.START_INDEX) int startIndex, @ApiParam(value = SCIMProviderConstants.COUNT_DESC, required = false) @QueryParam(SCIMProviderConstants.COUNT) int count, @ApiParam(value = SCIMProviderConstants.SORT_BY_DESC, required = false) @QueryParam(SCIMProviderConstants.SORT_BY) String sortBy, @ApiParam(value = SCIMProviderConstants.SORT_ORDER_DESC, required = false) @QueryParam(SCIMProviderConstants.SORT_ORDER) String sortOrder) throws FormatNotSupportedException, CharonException {
try {
// obtain the user store manager
UserManager userManager = DefaultCharonManager.getInstance().getUserManager();
// create charon-SCIM user resource manager and hand-over the request.
UserResourceManager userResourceManager = new UserResourceManager();
SCIMResponse scimResponse = userResourceManager.listWithGET(userManager, filter, startIndex, count, sortBy, sortOrder, attribute, excludedAttributes);
return buildResponse(scimResponse);
} catch (CharonException e) {
throw new CharonException(e.getDetail(), e);
}
}
use of org.wso2.charon3.core.protocol.endpoints.UserResourceManager in project charon by wso2.
the class BulkRequestProcessor method processBulkRequests.
public BulkResponseData processBulkRequests(BulkRequestData bulkRequestData) throws BadRequestException {
BulkResponseData bulkResponseData = new BulkResponseData();
SCIMResponse response = null;
for (BulkRequestContent bulkRequestContent : bulkRequestData.getUserOperationRequests()) {
if (failOnError == 0) {
bulkResponseData.addUserOperation(getBulkResponseContent(bulkRequestContent, userResourceManager));
} else {
if (errors < failOnError) {
bulkResponseData.addUserOperation(getBulkResponseContent(bulkRequestContent, userResourceManager));
}
}
}
for (BulkRequestContent bulkRequestContent : bulkRequestData.getGroupOperationRequests()) {
if (failOnError == 0) {
bulkResponseData.addGroupOperation(getBulkResponseContent(bulkRequestContent, groupResourceManager));
} else {
if (errors < failOnError) {
bulkResponseData.addGroupOperation(getBulkResponseContent(bulkRequestContent, groupResourceManager));
}
}
}
bulkResponseData.setSchema(SCIMConstants.BULK_RESPONSE_URI);
return bulkResponseData;
}
use of org.wso2.charon3.core.protocol.endpoints.UserResourceManager in project charon by wso2.
the class UserResource method updateUser.
@PUT
@Path("{id}")
@Produces({ "application/json", "application/scim+json" })
@Consumes("application/scim+json")
@ApiOperation(value = "Return the updated user", notes = "Returns HTTP 404 if the user is not found.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "User is updated"), @ApiResponse(code = 404, message = "Valid user is not found") })
public Response updateUser(@ApiParam(value = SCIMProviderConstants.ID_DESC, required = true) @PathParam(SCIMProviderConstants.ID) String id, @ApiParam(value = SCIMProviderConstants.ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.ATTRIBUTES) String attribute, @ApiParam(value = SCIMProviderConstants.EXCLUDED_ATTRIBUTES_DESC, required = false) @QueryParam(SCIMProviderConstants.EXCLUDE_ATTRIBUTES) String excludedAttributes, String resourceString) throws FormatNotSupportedException, CharonException {
try {
// obtain the user store manager
UserManager userManager = DefaultCharonManager.getInstance().getUserManager();
// create charon-SCIM user endpoint and hand-over the request.
UserResourceManager userResourceManager = new UserResourceManager();
SCIMResponse response = userResourceManager.updateWithPUT(id, resourceString, userManager, attribute, excludedAttributes);
return buildResponse(response);
} catch (CharonException e) {
throw new CharonException(e.getDetail(), e);
}
}
Aggregations