From 6ad6bbbdc0f91b3c9674019e716ec63227c6e491 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Thu, 8 Dec 2016 20:41:44 +0530 Subject: [PATCH] Commiting permission-scope mapping improvements --- .../service/impl/AndroidSenseService.java | 10 +++++----- .../mgt/iot/arduino/service/impl/ArduinoService.java | 8 ++++---- .../raspberrypi/service/impl/RaspberryPiService.java | 6 +++--- .../service/impl/VirtualFireAlarmService.java | 6 +++--- .../api/services/DeviceManagementAdminService.java | 12 ++++++------ .../windows/api/services/authbst/BSTProvider.java | 3 +-- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 2c60c0b4df..6a215bf7c5 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -54,7 +54,7 @@ public interface AndroidSenseService { */ @Path("device/{deviceId}/words") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + //@Scope(key = "device:android-sense:enroll", name = "", description = "") Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); /** @@ -65,12 +65,12 @@ public interface AndroidSenseService { */ @Path("device/{deviceId}/words/threshold") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + //@Scope(key = "device:android-sense:enroll", name = "", description = "") Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold); @Path("device/{deviceId}/words") @DELETE - @Scope(key = "device:android-sense:enroll", name = "", description = "") + //@Scope(key = "device:android-sense:enroll", name = "", description = "") Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); /** @@ -79,7 +79,7 @@ public interface AndroidSenseService { @Path("stats/{deviceId}/sensors/{sensorName}") @GET @Consumes("application/json") - @Scope(key = "device:android-sense:enroll", name = "", description = "") + //@Scope(key = "device:android-sense:enroll", name = "", description = "") @Produces("application/json") Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, @QueryParam("from") long from, @QueryParam("to") long to); @@ -89,7 +89,7 @@ public interface AndroidSenseService { */ @Path("device/{device_id}/register") @POST - @Scope(key = "device:android-sense:enroll", name = "", description = "") + //@Scope(key = "device:android-sense:enroll", name = "", description = "") Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); } diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java index cd0ef710b5..1dd0500134 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoService.java @@ -48,12 +48,12 @@ public interface ArduinoService { @Path("device/{deviceId}/bulb") @POST - @Scope(key = "device:arduino:enroll", name = "", description = "") + //@Scope(key = "device:arduino:enroll", name = "", description = "") Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); @Path("device/{deviceId}/controls") @GET - @Scope(key = "device:arduino:enroll", name = "", description = "") + //@Scope(key = "device:arduino:enroll", name = "", description = "") Response readControls(@PathParam("deviceId") String deviceId); /** @@ -63,7 +63,7 @@ public interface ArduinoService { @GET @Consumes("application/json") @Produces("application/json") - @Scope(key = "device:arduino:enroll", name = "", description = "") + //@Scope(key = "device:arduino:enroll", name = "", description = "") Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to); @@ -73,7 +73,7 @@ public interface ArduinoService { @Path("device/download") @GET @Produces("application/octet-stream") - @Scope(key = "device:arduino:enroll", name = "", description = "") + //@Scope(key = "device:arduino:enroll", name = "", description = "") Response downloadSketch(@QueryParam("deviceName") String customDeviceName); } diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java index 812c584394..816f3e6b9a 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiService.java @@ -48,7 +48,7 @@ public interface RaspberryPiService { @Path("device/{deviceId}/bulb") @POST - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + //@Scope(key = "device:raspberrypi:enroll", name = "", description = "") Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); /** @@ -58,7 +58,7 @@ public interface RaspberryPiService { @GET @Consumes("application/json") @Produces("application/json") - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + //@Scope(key = "device:raspberrypi:enroll", name = "", description = "") Response getRaspberryPiTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to); @@ -68,7 +68,7 @@ public interface RaspberryPiService { @Path("device/download") @GET @Produces(MediaType.APPLICATION_JSON) - @Scope(key = "device:raspberrypi:enroll", name = "", description = "") + //@Scope(key = "device:raspberrypi:enroll", name = "", description = "") Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType); } diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java index 75db835b7b..62be0f612f 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmService.java @@ -63,7 +63,7 @@ public interface VirtualFireAlarmService { */ @POST @Path("device/{deviceId}/buzz") - @Scope(key = "device:firealarm:enroll", name = "", description = "") + //@Scope(key = "device:firealarm:enroll", name = "", description = "") Response switchBuzzer(@PathParam("deviceId") String deviceId, @FormParam("state") String state); @@ -72,7 +72,7 @@ public interface VirtualFireAlarmService { */ @Path("device/stats/{deviceId}") @GET - @Scope(key = "device:firealarm:enroll", name = "", description = "") + //@Scope(key = "device:firealarm:enroll", name = "", description = "") @Consumes("application/json") @Produces("application/json") Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @@ -81,7 +81,7 @@ public interface VirtualFireAlarmService { @Path("device/download") @GET @Produces("application/zip") - @Scope(key = "device:firealarm:enroll", name = "", description = "") + //@Scope(key = "device:firealarm:enroll", name = "", description = "") Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java index 5e325938c5..ad2dc20080 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java @@ -24,7 +24,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import javax.jws.WebService; @@ -68,31 +67,32 @@ public interface DeviceManagementAdminService { @POST @Path("/lock-devices") - @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock") + //@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock") Response lock(@HeaderParam("Accept") String headerParam, List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/disenroll-devices") - @Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows") + //@Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows") Response disenroll(@HeaderParam("Accept") String headerParam, List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/wipe-devices") - @Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe") + //@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe") Response wipe(@HeaderParam("Accept") String headerParam, List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/ring-devices") - @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring") + //@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring") Response ring(@HeaderParam("Accept") String headerParam, List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/lock-reset-devices") - @Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock-reset") + //@Permission(name = "Lock-Reset Device", permission = + // "/device-mgt/devices/owning-device/operations/windows/lock-reset") Response lockReset(@HeaderParam("Accept") String acceptHeader, List deviceIds) throws WindowsDeviceEnrolmentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java index 220d0e02da..e0736e3fcf 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java @@ -18,7 +18,6 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst; -import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; @@ -37,6 +36,6 @@ public interface BSTProvider { @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/authentication") - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") + // @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") Response getBST(Credentials credentials) throws WindowsDeviceEnrolmentException; }