From 1ffbb2183aa405530c0189c1a19cf71b9cb149c4 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 27 May 2016 14:20:10 +0530 Subject: [PATCH] adding permissions for DM services --- .../api/ActivityInfoProviderService.java | 7 +- .../service/api/DeviceManagementService.java | 14 +- .../src/main/webapp/META-INF/permissions.xml | 166 ++++++++++-------- 3 files changed, 104 insertions(+), 83 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 895287c3826..544389d8413 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -42,17 +42,16 @@ public interface ActivityInfoProviderService { @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", + httpMethod = "GET", value = "Retrieving the operation details.", notes = "This will return the operation details including the responses from the devices.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Activity details provided successfully."), @ApiResponse(code = 500, message = "Error occurred while fetching the activity for the supplied id.") }) - @Permission(scope = "operation-view", permissions = {"/permission/admin/device-mgt/admin/devices/view"}) + @Permission(scope = "activity-view", permissions = {"/permission/admin/device-mgt/admin/activities/view"}) Response getActivity( - @ApiParam(name = "id", value = "Activity id of the operation/activity to be retrieved.", - required = true) + @ApiParam(name = "id", value = "Activity id of the operation/activity to be retrieved.", required = true) @PathParam("id") String id); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index cb1e4e395c0..a7d6ce64f36 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -55,8 +55,8 @@ public interface DeviceManagementService { response = org.wso2.carbon.device.mgt.common.Device.class, responseContainer = "List") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successfully fetched the list of devices.", response = org.wso2.carbon - .device.mgt.common.Device.class, responseContainer = "List"), + @ApiResponse(code = 200, message = "Successfully fetched the list of devices.", + response = org.wso2.carbon.device.mgt.common.Device.class, responseContainer = "List"), @ApiResponse(code = 404, message = "No device has currently been under the provided type."), @ApiResponse(code = 500, message = "Error occurred while fetching the device list.") }) @@ -68,8 +68,14 @@ public interface DeviceManagementService { "index.", required = true) @QueryParam("limit") int limit); - Response getDevices(@HeaderParam("If-Modified-Since") Date timestamp, @QueryParam("offset") int offset, - @QueryParam("limit") int limit); + Response getDevices( + @ApiParam(name = "If-Modified-Since", value = "Time since the device information changed.") + @HeaderParam("If-Modified-Since") Date timestamp, + @ApiParam(name = "offset", value = "Starting pagination index.",required = true) + @QueryParam("offset") int offset, + @ApiParam(name = "limit", value = "How many device details are required from the starting pagination " + + "index.", required = true) + @QueryParam("limit") int limit); @GET @ApiOperation( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml index 8146d01640b..a886c71925a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/META-INF/permissions.xml @@ -29,7 +29,98 @@ --> + + + + Fetch Activity related details + /device-mgt/admin/activities/view + /activities/* + GET + + + + List devices + /device-mgt/admin/devices/list + /devices + GET + + + + List device types + /device-mgt/admin/devices/list + /devices/types + GET + + + + List device types + /device-mgt/user/devices/list + /devices/types + GET + + + + Add policy + /device-mgt/admin/policies/add + /devices/types + GET + + + + Add User policy + /device-mgt/user/policies/add + /devices/types + GET + + + + Edit policy + /device-mgt/admin/policies/update + /devices/types + GET + + + + Edit User policy + /device-mgt/user/policies/update + /devices/types + GET + + + + View device + /device-mgt/admin/devices/view + /devices/view + GET + + + + View user device + /device-mgt/user/devices/view + /devices/view + GET + + + + Modify user device + /device-mgt/user/devices/update + /devices/type/*/id/* + PUT + + + + Remove user device + /device-mgt/user/devices/remove + /devices/type/*/id/* + DELETE + + + + + + + Device Management @@ -143,82 +234,7 @@ GET - - List devices - /device-mgt/admin/devices/list - /devices - GET - - - - List device types - /device-mgt/admin/devices/list - /devices/types - GET - - - - List device types - /device-mgt/user/devices/list - /devices/types - GET - - - - Add policy - /device-mgt/admin/policies/add - /devices/types - GET - - - - Add User policy - /device-mgt/user/policies/add - /devices/types - GET - - - - Edit policy - /device-mgt/admin/policies/update - /devices/types - GET - - - - Edit User policy - /device-mgt/user/policies/update - /devices/types - GET - - - - View device - /device-mgt/admin/devices/view - /devices/view - GET - - - View user device - /device-mgt/user/devices/view - /devices/view - GET - - - - Modify user device - /device-mgt/user/devices/update - /devices/type/*/id/* - PUT - - - - Remove user device - /device-mgt/user/devices/remove - /devices/type/*/id/* - DELETE -