adding role filtering for device cloud via api

revert-70aa11f8
kamidu 8 years ago
parent fc6c8e0290
commit a77794f81a

@ -18,17 +18,7 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.api; package org.wso2.carbon.device.mgt.jaxrs.service.api;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
@ -120,7 +110,7 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting the List of Roles", value = "Getting the List of Roles",
notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 EMM.\n" + notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 IoTS.\n" +
"Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.", "Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.",
tags = "Role Management", tags = "Role Management",
extensions = { extensions = {
@ -133,7 +123,7 @@ public interface RoleManagementService {
value = { value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully fetched the list of roles in WSO2 EMM.", message = "OK. \n Successfully fetched the list of roles in WSO2 IoTS.",
response = RoleList.class, response = RoleList.class,
responseHeaders = { responseHeaders = {
@ResponseHeader( @ResponseHeader(
@ -190,6 +180,88 @@ public interface RoleManagementService {
defaultValue = "5") defaultValue = "5")
@QueryParam("limit") int limit); @QueryParam("limit") int limit);
@GET
@Path("/roles/filter/{prefix}")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting the List of Roles filtered by the given prefix",
notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 IoTS.\n" +
"Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.",
tags = "Role Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the list of roles in WSO2 IoTS.",
response = RoleList.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching list of roles.",
response = ErrorResponse.class)
})
Response getFilteredRoles(
@ApiParam(
name = "prefix",
value = "Filtering prefix of the role.",
required = true,
defaultValue = "")
@PathParam("prefix") String prefix,
@ApiParam(
name = "filter",
value = "Provide a character or a few characters in the role name.",
required = false)
@QueryParam("filter") String filter,
@ApiParam(
name = "user-store",
value = "The name of the UserStore you wish to get the list of roles.",
required = false)
@QueryParam("user-store") String userStoreName,
@ApiParam(
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time." +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince,
@ApiParam(
name = "offset",
value = "The starting pagination index for the complete list of qualified items.",
required = false,
defaultValue = "0")
@QueryParam("offset") int offset,
@ApiParam(
name = "limit",
value = "Provide how many role details you require from the starting pagination index/offset.",
required = false,
defaultValue = "5")
@QueryParam("limit") int limit);
@GET @GET
@Path("/{roleName}/permissions") @Path("/{roleName}/permissions")
@ApiOperation( @ApiOperation(
@ -197,7 +269,7 @@ public interface RoleManagementService {
httpMethod = "GET", httpMethod = "GET",
value = "Getting Permission Details of a Role", value = "Getting Permission Details of a Role",
notes = "An individual is associated a with set of responsibilities based on their " + notes = "An individual is associated a with set of responsibilities based on their " +
"role. In WSO2 EMM you are able to configure permissions based on the responsibilities carried " + "role. In WSO2 IoTS you are able to configure permissions based on the responsibilities carried " +
"out by various roles. Therefore, if you wish to retrieve the permission details of a role, you can do " + "out by various roles. Therefore, if you wish to retrieve the permission details of a role, you can do " +
"so using this REST API.", "so using this REST API.",
response = UIPermissionNode.class, response = UIPermissionNode.class,
@ -350,7 +422,7 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Adding a Role", value = "Adding a Role",
notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new role to WSO2 EMM using this REST API.", notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Add a new role to WSO2 IoTS using this REST API.",
tags = "Role Management", tags = "Role Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ -410,7 +482,7 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Adding a combined Role", value = "Adding a combined Role",
notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 EMM using this REST API.", notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 IoTS using this REST API.",
tags = "Role Management", tags = "Role Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {

Loading…
Cancel
Save