Merge pull request #314 from milanperera/scope-impl

Merging scope based authorization implementation
revert-dabc3590
Chatura Dilan 8 years ago committed by GitHub
commit 3481b02d5b

@ -19,17 +19,11 @@
package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; package org.wso2.carbon.device.mgt.iot.androidsense.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.*;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@DeviceType(value = "android_sense") @DeviceType(value = "android_sense")
@ -45,7 +39,7 @@ public interface AndroidSenseService {
@Path("device/{deviceId}/words") @Path("device/{deviceId}/words")
@POST @POST
@Feature(code = "keywords", name = "Add Keywords", description = "Send keywords to the device") @Feature(code = "keywords", name = "Add Keywords", description = "Send keywords to the device")
@Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:android-sense:enroll", name = "", description = "")
Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords);
/** /**
@ -57,13 +51,13 @@ public interface AndroidSenseService {
@Path("device/{deviceId}/words/threshold") @Path("device/{deviceId}/words/threshold")
@POST @POST
@Feature(code = "threshold", name = "Add a Threshold", description = "Set a threshold for word in the device") @Feature(code = "threshold", name = "Add a Threshold", description = "Set a threshold for word in the device")
@Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:android-sense:enroll", name = "", description = "")
Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold); Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold);
@Path("device/{deviceId}/words") @Path("device/{deviceId}/words")
@DELETE @DELETE
@Feature(code = "remove", name = "Remove Keywords", description = "Remove the keywords") @Feature(code = "remove", name = "Remove Keywords", description = "Remove the keywords")
@Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:android-sense:enroll", name = "", description = "")
Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words);
/** /**
@ -72,7 +66,7 @@ public interface AndroidSenseService {
@Path("stats/{deviceId}/sensors/{sensorName}") @Path("stats/{deviceId}/sensors/{sensorName}")
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/stats"}) @Scope(key = "device:android-sense:enroll", name = "", description = "")
@Produces("application/json") @Produces("application/json")
Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor,
@QueryParam("from") long from, @QueryParam("to") long to); @QueryParam("from") long from, @QueryParam("to") long to);
@ -82,7 +76,7 @@ public interface AndroidSenseService {
*/ */
@Path("device/{device_id}/register") @Path("device/{device_id}/register")
@POST @POST
@Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices"}) @Scope(key = "device:android-sense:enroll", name = "", description = "")
Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName);
} }

@ -19,16 +19,11 @@
package org.wso2.carbon.device.mgt.iot.arduino.service.impl; package org.wso2.carbon.device.mgt.iot.arduino.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.*;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "arduino", version = "1.0.0", context = "/arduino", tags = {"arduino"}) @API(name = "arduino", version = "1.0.0", context = "/arduino", tags = {"arduino"})
@ -38,12 +33,12 @@ public interface ArduinoService {
@Path("device/{deviceId}/bulb") @Path("device/{deviceId}/bulb")
@POST @POST
@Feature(code = "bulb", name = "Control Bulb", description = "Control Bulb on Arduino Uno") @Feature(code = "bulb", name = "Control Bulb", description = "Control Bulb on Arduino Uno")
@Permission(scope = "arduino_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:arduino:enroll", name = "", description = "")
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
@Path("device/{deviceId}/controls") @Path("device/{deviceId}/controls")
@GET @GET
@Permission(scope = "arduino_device", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:arduino:enroll", name = "", description = "")
Response readControls(@PathParam("deviceId") String deviceId); Response readControls(@PathParam("deviceId") String deviceId);
/** /**
@ -53,7 +48,7 @@ public interface ArduinoService {
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
@Permission(scope = "arduino_user", permissions = {"/permission/admin/device-mgt/user/stats"}) @Scope(key = "device:arduino:enroll", name = "", description = "")
Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
@QueryParam("to") long to); @QueryParam("to") long to);
@ -63,7 +58,7 @@ public interface ArduinoService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces("application/octet-stream") @Produces("application/octet-stream")
@Permission(scope = "arduino_user", permissions = {"/permission/admin/device-mgt/user/devices"}) @Scope(key = "device:arduino:enroll", name = "", description = "")
Response downloadSketch(@QueryParam("deviceName") String customDeviceName); Response downloadSketch(@QueryParam("deviceName") String customDeviceName);
} }

@ -19,16 +19,11 @@
package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl; package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.*;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@ -39,7 +34,7 @@ public interface RaspberryPiService {
@Path("device/{deviceId}/bulb") @Path("device/{deviceId}/bulb")
@POST @POST
@Feature(code = "bulb", name = "Bulb On / Off", description = "Switch on/off Raspberry Pi agent's bulb. (On / Off)") @Feature(code = "bulb", name = "Bulb On / Off", description = "Switch on/off Raspberry Pi agent's bulb. (On / Off)")
@Permission(scope = "raspberrypi_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:raspberrypi:enroll", name = "", description = "")
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
/** /**
@ -49,7 +44,7 @@ public interface RaspberryPiService {
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
@Permission(scope = "raspberrypi_user", permissions = {"/permission/admin/device-mgt/user/stats"}) @Scope(key = "device:raspberrypi:enroll", name = "", description = "")
Response getRaspberryPiTemperatureStats(@PathParam("deviceId") String deviceId, Response getRaspberryPiTemperatureStats(@PathParam("deviceId") String deviceId,
@QueryParam("from") long from, @QueryParam("to") long to); @QueryParam("from") long from, @QueryParam("to") long to);
@ -59,7 +54,7 @@ public interface RaspberryPiService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Permission(scope = "raspberrypi_user", permissions = {"/permission/admin/device-mgt/user/devices"}) @Scope(key = "device:raspberrypi:enroll", name = "", description = "")
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType);
} }

@ -19,7 +19,7 @@
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
@ -48,7 +48,7 @@ public interface VirtualFireAlarmService {
*/ */
@POST @POST
@Path("device/{deviceId}/buzz") @Path("device/{deviceId}/buzz")
@Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/operations"}) @Scope(key = "device:firealarm:enroll", name = "", description = "")
@Feature(code = "buzz", name = "Buzzer On / Off", description = "Switch on/off Virtual Fire Alarm Buzzer. (On / Off)") @Feature(code = "buzz", name = "Buzzer On / Off", description = "Switch on/off Virtual Fire Alarm Buzzer. (On / Off)")
Response switchBuzzer(@PathParam("deviceId") String deviceId, Response switchBuzzer(@PathParam("deviceId") String deviceId,
@FormParam("state") String state); @FormParam("state") String state);
@ -58,7 +58,7 @@ public interface VirtualFireAlarmService {
*/ */
@Path("device/stats/{deviceId}") @Path("device/stats/{deviceId}")
@GET @GET
@Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/stats"}) @Scope(key = "device:firealarm:enroll", name = "", description = "")
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
@ -67,7 +67,7 @@ public interface VirtualFireAlarmService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces("application/zip") @Produces("application/zip")
@Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/devices"}) @Scope(key = "device:firealarm:enroll", name = "", description = "")
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
} }

@ -19,6 +19,8 @@
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*; import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
@ -30,6 +32,10 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@API(name = "Android Device Management Administrative Service", version = "1.0.0",
context = "api/device-mgt/android/v1.0/admin/devices",
tags = {"devicemgt_android"})
@Path("/admin/devices") @Path("/admin/devices")
@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.") @Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -85,6 +91,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new lock operation.") "Server error occurred while adding a new lock operation.")
}) })
@Scope(key = "device:android:operation:lock", name = "Lock device", description = "")
Response configureDeviceLock( Response configureDeviceLock(
@ApiParam(name = "deviceLockBeanWrapper", @ApiParam(name = "deviceLockBeanWrapper",
value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper); value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper);
@ -138,6 +145,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new un-lock operation.") "Server error occurred while adding a new un-lock operation.")
}) })
@Scope(key = "device:android:operation:unlock", name = "Unlock device", description = "")
Response configureDeviceUnlock( Response configureDeviceUnlock(
@ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation") @ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation")
List<String> deviceIDs); List<String> deviceIDs);
@ -190,6 +198,7 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-location operation.")}) "Server error occurred while adding a new get-location operation.")})
@Scope(key = "device:android:operation:location", name = "Get device location", description = "")
Response getDeviceLocation( Response getDeviceLocation(
@ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location") @ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location")
List<String> deviceIDs); List<String> deviceIDs);
@ -242,6 +251,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new clear password operation.") "Server error occurred while adding a new clear password operation.")
}) })
@Scope(key = "device:android:operation:clear-password", name = "Clear password of device", description = "")
Response removePassword( Response removePassword(
@ApiParam(name = "deviceIDs", @ApiParam(name = "deviceIDs",
value = "DeviceIds to be requested to remove password") List<String> deviceIDs); value = "DeviceIds to be requested to remove password") List<String> deviceIDs);
@ -294,6 +304,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new control camera operation.") "Server error occurred while adding a new control camera operation.")
}) })
@Scope(key = "device:android:operation:camera", name = "Enable/Disable camera", description = "")
Response configureCamera( Response configureCamera(
@ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs") @ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs")
CameraBeanWrapper cameraBeanWrapper); CameraBeanWrapper cameraBeanWrapper);
@ -349,6 +360,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device info operation.") "Server error occurred while adding a new device info operation.")
}) })
@Scope(key = "device:android:operation:info", name = "Get device information", description = "")
Response getDeviceInformation( Response getDeviceInformation(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information") @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information")
List<String> deviceIDs); List<String> deviceIDs);
@ -457,6 +469,7 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a enterprise wipe operation.")}) "Server error occurred while adding a enterprise wipe operation.")})
@Scope(key = "device:android:operation:enterprise-wipe", name = "Enterprise wipe", description = "")
Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe") Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe")
List<String> deviceIDs); List<String> deviceIDs);
@ -508,6 +521,7 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a device wipe operation.")}) "Server error occurred while adding a device wipe operation.")})
@Scope(key = "device:android:operation:wipe", name = "Factory reset device", description = "")
Response wipeData( Response wipeData(
@ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data") @ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data")
WipeDataBeanWrapper wipeDataBeanWrapper); WipeDataBeanWrapper wipeDataBeanWrapper);
@ -564,6 +578,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-applications operation.") "Server error occurred while adding a new get-applications operation.")
}) })
@Scope(key = "device:android:operation:applications", name = "Get installed applications", description = "")
Response getApplications( Response getApplications(
@ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed") @ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed")
List<String> deviceIDs); List<String> deviceIDs);
@ -616,6 +631,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device ring operation.") "Server error occurred while adding a new device ring operation.")
}) })
@Scope(key = "device:android:operation:ring", name = "Ring device", description = "")
Response ringDevice( Response ringDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring")
List<String> deviceIDs); List<String> deviceIDs);
@ -668,6 +684,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device reboot operation.") "Server error occurred while adding a new device reboot operation.")
}) })
@Scope(key = "device:android:operation:reboot", name = "Reboot device", description = "")
Response rebootDevice( Response rebootDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.")
List<String> deviceIDs); List<String> deviceIDs);
@ -720,6 +737,7 @@ public interface DeviceManagementAdminService {
"Server error occurred while adding a new device mute operation.") "Server error occurred while adding a new device mute operation.")
}) })
@Path("/mute") @Path("/mute")
@Scope(key = "device:android:operation:mute", name = "Mute device", description = "")
Response muteDevice( Response muteDevice(
@ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") @ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted")
List<String> deviceIDs); List<String> deviceIDs);
@ -775,6 +793,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new install-application operation.") "Server error occurred while adding a new install-application operation.")
}) })
@Scope(key = "device:android:operation:install-app", name = "Install applications", description = "")
Response installApplication( Response installApplication(
@ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs") @ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs")
ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper);
@ -830,6 +849,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new update-application operation.") "Server error occurred while adding a new update-application operation.")
}) })
@Scope(key = "device:android:operation:update-app", name = "Update installed applications", description = "")
Response updateApplication( Response updateApplication(
@ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs") @ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs")
ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper);
@ -882,6 +902,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new uninstall-application operation.") "Server error occurred while adding a new uninstall-application operation.")
}) })
@Scope(key = "device:android:operation:uninstall-app", name = "Uninstall applications", description = "")
Response uninstallApplication( Response uninstallApplication(
@ApiParam(name = "applicationUninstallationBeanWrapper", @ApiParam(name = "applicationUninstallationBeanWrapper",
value = "applicationUninstallationConfigs and Device Ids") value = "applicationUninstallationConfigs and Device Ids")
@ -936,6 +957,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new blacklist-applications operation.") "Server error occurred while adding a new blacklist-applications operation.")
}) })
@Scope(key = "device:android:operation:blacklist-app", name = "Blacklist applications", description = "")
Response blacklistApplications( Response blacklistApplications(
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
"Configuration and DeviceIds") "Configuration and DeviceIds")
@ -990,6 +1012,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new upgrade firmware operation.") "Server error occurred while adding a new upgrade firmware operation.")
}) })
@Scope(key = "device:android:operation:upgrade", name = "Upgrade firmware", description = "")
Response upgradeFirmware( Response upgradeFirmware(
@ApiParam(name = "upgradeFirmwareBeanWrapper", @ApiParam(name = "upgradeFirmwareBeanWrapper",
value = "Firmware upgrade configuration and DeviceIds") value = "Firmware upgrade configuration and DeviceIds")
@ -1044,6 +1067,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure VPN operation.") "Server error occurred while adding a new configure VPN operation.")
}) })
@Scope(key = "device:android:operation:vpn", name = "Add VPN profiles", description = "")
Response configureVPN( Response configureVPN(
@ApiParam(name = "vpnBeanWrapper", @ApiParam(name = "vpnBeanWrapper",
value = "VPN configuration and DeviceIds") value = "VPN configuration and DeviceIds")
@ -1097,6 +1121,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new send notification operation.") "Server error occurred while adding a new send notification operation.")
}) })
@Scope(key = "device:android:operation:notification", name = "Send notifications", description = "")
Response sendNotification( Response sendNotification(
@ApiParam(name = "notificationBeanWrapper", @ApiParam(name = "notificationBeanWrapper",
value = "Notification Configurations and device Ids") value = "Notification Configurations and device Ids")
@ -1150,6 +1175,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure wifi operation.") "Server error occurred while adding a new configure wifi operation.")
}) })
@Scope(key = "device:android:operation:wifi", name = "Add WiFi configurations", description = "")
Response configureWifi( Response configureWifi(
@ApiParam(name = "wifiBeanWrapper", @ApiParam(name = "wifiBeanWrapper",
value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper); value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper);
@ -1202,6 +1228,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new encrypt storage operation.") "Server error occurred while adding a new encrypt storage operation.")
}) })
@Scope(key = "device:android:operation:encrypt", name = "Encrypt device", description = "")
Response encryptStorage( Response encryptStorage(
@ApiParam(name = "encryptionBeanWrapper", @ApiParam(name = "encryptionBeanWrapper",
value = "Configurations and deviceIds need to be done data encryption") value = "Configurations and deviceIds need to be done data encryption")
@ -1255,6 +1282,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new change lock code operation.") "Server error occurred while adding a new change lock code operation.")
}) })
@Scope(key = "device:android:operation:change-lock", name = "Change password of device", description = "")
Response changeLockCode( Response changeLockCode(
@ApiParam(name = "lockCodeBeanWrapper", @ApiParam(name = "lockCodeBeanWrapper",
value = "Configurations and device Ids need to be done change lock code") value = "Configurations and device Ids need to be done change lock code")
@ -1308,6 +1336,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new set password policy operation.") "Server error occurred while adding a new set password policy operation.")
}) })
@Scope(key = "device:android:operation:password-policy", name = "Set password policy", description = "")
Response setPasswordPolicy( Response setPasswordPolicy(
@ApiParam(name = "passwordPolicyBeanWrapper", @ApiParam(name = "passwordPolicyBeanWrapper",
value = "Password Policy Configurations and Device Ids") value = "Password Policy Configurations and Device Ids")
@ -1361,6 +1390,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new set webclip operation.") "Server error occurred while adding a new set webclip operation.")
}) })
@Scope(key = "device:android:operation:webclip", name = "Add webclips", description = "")
Response setWebClip( Response setWebClip(
@ApiParam(name = "webClipBeanWrapper", @ApiParam(name = "webClipBeanWrapper",
value = "Configurations to need set web clip on device and device Ids") value = "Configurations to need set web clip on device and device Ids")

@ -19,6 +19,8 @@
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
@ -32,6 +34,10 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@API(name = "Android Device Management", version = "1.0.0",
context = "api/device-mgt/android/v1.0/devices",
tags = {"devicemgt_android"})
@Api(value = "Android Device Management", @Api(value = "Android Device Management",
description = "This carries all the resources related to Android device management functionalities") description = "This carries all the resources related to Android device management functionalities")
@Path("/devices") @Path("/devices")
@ -81,6 +87,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while updating the application list.") "Server error occurred while updating the application list.")
}) })
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
Response updateApplicationList( Response updateApplicationList(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -134,6 +141,7 @@ public interface DeviceManagementService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching policies.") message = "Internal Server Error. \n Server error occurred while fetching policies.")
}) })
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
Response getPendingOperations( Response getPendingOperations(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -198,6 +206,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new policy.") "Server error occurred while adding a new policy.")
}) })
Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll")
@Valid AndroidDevice device); @Valid AndroidDevice device);
@ -236,6 +245,7 @@ public interface DeviceManagementService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.") message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.")
}) })
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
Response isEnrolled( Response isEnrolled(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -289,6 +299,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while updating the device enrollment.") "Server error occurred while updating the device enrollment.")
}) })
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
Response modifyEnrollment( Response modifyEnrollment(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -318,6 +329,7 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while dis-enrolling the device.") "Server error occurred while dis-enrolling the device.")
}) })
@Scope(key = "device:android:disenroll", name = "Enroll Android device", description = "")
Response disEnrollDevice( Response disEnrollDevice(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -19,6 +19,8 @@
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
@ -28,6 +30,10 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Android Configuration Management", version = "1.0.0",
context = "api/device-mgt/android/v1.0/configuration",
tags = {"devicemgt_android"})
@Api(value = "Android Configuration Management", description = "This API carries all resource associated with " + @Api(value = "Android Configuration Management", description = "This API carries all resource associated with " +
"manipulating the general configurations of Android platform") "manipulating the general configurations of Android platform")
@Path("/configuration") @Path("/configuration")
@ -75,6 +81,7 @@ public interface DeviceTypeConfigurationService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.") message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.")
}) })
@Scope(key = "configuration:view", name = "View configurations", description = "")
Response getConfiguration( Response getConfiguration(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
@ -124,6 +131,7 @@ public interface DeviceTypeConfigurationService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying Android platform configuration.") "Server error occurred while modifying Android platform configuration.")
}) })
@Scope(key = "configuration:manage", name = "Add configurations", description = "")
Response updateConfiguration( Response updateConfiguration(
@ApiParam(name = "configuration", @ApiParam(name = "configuration",
value = "AndroidPlatformConfiguration") value = "AndroidPlatformConfiguration")
@ -171,6 +179,7 @@ public interface DeviceTypeConfigurationService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.") message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.")
}) })
@Scope(key = "device:android:enroll", name = "Enroll Android device", description = "")
Response getLicense( Response getLicense(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",

@ -19,6 +19,8 @@
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
@ -28,6 +30,10 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Android Event Receiver", version = "1.0.0",
context = "api/device-mgt/android/v1.0/events",
tags = {"devicemgt_android"})
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.To enable Eventing need to" + @Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.To enable Eventing need to" +
" configure as ref-https://docs.wso2.com/display/EMM210/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " + " configure as ref-https://docs.wso2.com/display/EMM210/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " +
"https://docs.wso2.com/display/EMM210/Creating+a+New+Event+Stream+and+Receiver") "https://docs.wso2.com/display/EMM210/Creating+a+New+Event+Stream+and+Receiver")
@ -84,6 +90,7 @@ public interface EventReceiverService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while publishing events.") "Server error occurred while publishing events.")
}) })
@Scope(key = "device:android:event:write", name = "Publish events to DAS", description = "")
Response publishEvents( Response publishEvents(
@ApiParam( @ApiParam(
name = "eventBeanWrapper", name = "eventBeanWrapper",
@ -133,7 +140,7 @@ public interface EventReceiverService {
code = 500, code = 500,
message = "Error occurred while getting published events for specific device.") message = "Error occurred while getting published events for specific device.")
}) })
@Scope(key = "device:android:event:read", name = "View events", description = "")
Response retrieveAlerts( Response retrieveAlerts(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -51,7 +51,7 @@
<property name="version" value="1.0"/> <property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/> <property name="host" value="localhost:9443"/>
<property name="schemes" value="https" /> <property name="schemes" value="https" />
<property name="basePath" value="/api/device-mgt/android/v1.0"/> <property name="basePath" value="/api-device-mgt-android-v1.0"/>
<property name="title" value="Android Device Management API Definitions"/> <property name="title" value="Android Device Management API Definitions"/>
<property name="contact" value="dev@wso2.org"/> <property name="contact" value="dev@wso2.org"/>
<property name="license" value="Apache 2.0"/> <property name="license" value="Apache 2.0"/>

@ -49,7 +49,7 @@
</context-param> </context-param>
<context-param> <context-param>
<param-name>managed-api-enabled</param-name> <param-name>managed-api-enabled</param-name>
<param-value>false</param-value> <param-value>true</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>managed-api-owner</param-name> <param-name>managed-api-owner</param-name>

Loading…
Cancel
Save