Added scopes to APIS

revert-dabc3590
mharindu 9 years ago
parent bedb171eb7
commit f675468e44

@ -45,7 +45,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"}) @Permission(scope = "android_sense_user", roles = {"/permission/admin/device-mgt/user/operations"})
Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords);
/** /**
@ -57,13 +57,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"}) @Permission(scope = "android_sense_user", roles = {"emm-user"})
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"}) @Permission(scope = "android_sense_user", roles = {"emm-user"})
Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words);
/** /**
@ -72,7 +72,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"}) @Permission(scope = "android_sense_user", roles = {"emm-user"})
@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 +82,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"}) @Permission(scope = "android_sense_user", roles = {"emm-user"})
Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName);
} }

@ -38,12 +38,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"}) @Permission(scope = "arduino_user", roles = {"emm-user"})
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"}) @Permission(scope = "arduino_device", roles = {"emm-user"})
Response readControls(@PathParam("deviceId") String deviceId); Response readControls(@PathParam("deviceId") String deviceId);
/** /**
@ -53,7 +53,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"}) @Permission(scope = "arduino_user", roles = {"emm-user"})
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 +63,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"}) @Permission(scope = "arduino_user", roles = {"emm-user"})
Response downloadSketch(@QueryParam("deviceName") String customDeviceName); Response downloadSketch(@QueryParam("deviceName") String customDeviceName);
} }

@ -39,7 +39,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"}) @Permission(scope = "raspberrypi_user", roles = {"emm-user"})
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
/** /**
@ -49,7 +49,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"}) @Permission(scope = "raspberrypi_user", roles = {"emm-user"})
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 +59,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"}) @Permission(scope = "raspberrypi_user", roles = {"emm-user"})
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType);
} }

@ -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"}) @Permission(scope = "virtual_firealarm_user", roles = {"emm-user"})
@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"}) @Permission(scope = "virtual_firealarm_user", roles = {"emm-user"})
@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"}) @Permission(scope = "virtual_firealarm_user", roles = {"emm-user"})
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
} }

@ -46,7 +46,7 @@
<version>2.2</version> <version>2.2</version>
<configuration> <configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes> <packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>api#device-mgt#android#v1.0</warName> <warName>api-device-mgt-android-v1.0</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -72,7 +72,7 @@
<tasks> <tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true"> <copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target"> <fileset dir="${basedir}/target">
<include name="api#device-mgt#android#v1.0.war" /> <include name="api-device-mgt-android-v1.0.war" />
</fileset> </fileset>
</copy> </copy>
</tasks> </tasks>

@ -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.Permission;
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.")
}) })
@Permission(scope = "device:android:lock", roles = {"admin"})
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.")
}) })
@Permission(scope = "device:android:unlock", roles = {"admin"})
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.")})
@Permission(scope = "device:android:location", roles = {"admin"})
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.")
}) })
@Permission(scope = "device:android:clear-password", roles = {"admin"})
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.")
}) })
@Permission(scope = "device:android:camera", roles = {"admin"})
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.")
}) })
@Permission(scope = "device:android:info", roles = {"admin"})
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);
@ -402,6 +414,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.")})
@Permission(scope = "device:android:enterprise-wipe", roles = {"admin"})
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);
@ -453,6 +466,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.")})
@Permission(scope = "device:android:wipe", roles = {"admin"})
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);
@ -509,6 +523,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.")
}) })
@Permission(scope = "device:android:get-applications", roles = {"admin"})
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);
@ -561,6 +576,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.")
}) })
@Permission(scope = "device:android:ring", roles = {"admin"})
Response ringDevice( Response ringDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List<String> deviceIDs);
@ -612,6 +628,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.")
}) })
@Permission(scope = "device:android:reboot", roles = {"admin"})
Response rebootDevice( Response rebootDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List<String> deviceIDs);
@ -663,6 +680,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")
@Permission(scope = "device:android:mute", roles = {"admin"})
Response muteDevice( Response muteDevice(
@ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List<String> deviceIDs);
@ -717,6 +735,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.")
}) })
@Permission(scope = "device:android:install-application", roles = {"admin"})
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);
@ -772,6 +791,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.")
}) })
@Permission(scope = "device:android:update-application", roles = {"admin"})
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);
@ -824,6 +844,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.")
}) })
@Permission(scope = "device:android:uninstall-application", roles = {"admin"})
Response uninstallApplication( Response uninstallApplication(
@ApiParam(name = "applicationUninstallationBeanWrapper", @ApiParam(name = "applicationUninstallationBeanWrapper",
value = "applicationUninstallationConfigs and Device Ids") value = "applicationUninstallationConfigs and Device Ids")
@ -878,6 +899,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.")
}) })
@Permission(scope = "device:android:blacklist-application", roles = {"admin"})
Response blacklistApplications( Response blacklistApplications(
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
"Configuration and DeviceIds") "Configuration and DeviceIds")
@ -932,6 +954,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.")
}) })
@Permission(scope = "device:android:upgrade-firmware", roles = {"admin"})
Response upgradeFirmware( Response upgradeFirmware(
@ApiParam(name = "upgradeFirmwareBeanWrapper", @ApiParam(name = "upgradeFirmwareBeanWrapper",
value = "Firmware upgrade configuration and DeviceIds") value = "Firmware upgrade configuration and DeviceIds")
@ -986,6 +1009,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.")
}) })
@Permission(scope = "device:android:vpn", roles = {"admin"})
Response configureVPN( Response configureVPN(
@ApiParam(name = "vpnBeanWrapper", @ApiParam(name = "vpnBeanWrapper",
value = "VPN configuration and DeviceIds") value = "VPN configuration and DeviceIds")
@ -1039,6 +1063,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.")
}) })
@Permission(scope = "device:android:send-notification", roles = {"admin"})
Response sendNotification( Response sendNotification(
@ApiParam(name = "notificationBeanWrapper", @ApiParam(name = "notificationBeanWrapper",
value = "Notification Configurations and device Ids") value = "Notification Configurations and device Ids")
@ -1092,6 +1117,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.")
}) })
@Permission(scope = "device:android:wifi", roles = {"admin"})
Response configureWifi( Response configureWifi(
@ApiParam(name = "wifiBeanWrapper", @ApiParam(name = "wifiBeanWrapper",
value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper); value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper);
@ -1144,6 +1170,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.")
}) })
@Permission(scope = "device:android:encrypt", roles = {"admin"})
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")
@ -1197,6 +1224,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.")
}) })
@Permission(scope = "device:android:change-lock-code", roles = {"admin"})
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")
@ -1250,6 +1278,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.")
}) })
@Permission(scope = "device:android:set-password-policy", roles = {"admin"})
Response setPasswordPolicy( Response setPasswordPolicy(
@ApiParam(name = "passwordPolicyBeanWrapper", @ApiParam(name = "passwordPolicyBeanWrapper",
value = "Password Policy Configurations and Device Ids") value = "Password Policy Configurations and Device Ids")
@ -1303,6 +1332,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.")
}) })
@Permission(scope = "device:android:webclip", roles = {"admin"})
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.Permission;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
@ -28,6 +30,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")
@ -77,6 +83,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
Response updateApplicationList( Response updateApplicationList(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -127,6 +134,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
Response getPendingOperations( Response getPendingOperations(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -191,6 +199,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device); Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device);
@GET @GET
@ -228,6 +237,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
Response isEnrolled( Response isEnrolled(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -281,6 +291,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
Response modifyEnrollment( Response modifyEnrollment(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -310,6 +321,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
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.Permission;
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.exception.AndroidAgentException; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
@ -26,6 +28,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")
@ -73,6 +79,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.")
}) })
@Permission(scope = "configuration:view", roles = {"admin"})
Response getConfiguration( Response getConfiguration(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
@ -122,6 +129,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.")
}) })
@Permission(scope = "configuration:modify", roles = {"admin"})
Response updateConfiguration( Response updateConfiguration(
@ApiParam(name = "configuration", @ApiParam(name = "configuration",
value = "AndroidPlatformConfiguration") value = "AndroidPlatformConfiguration")
@ -169,6 +177,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.")
}) })
@Permission(scope = "device:android:enroll", roles = {"admin"})
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.Permission;
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;
@ -26,6 +28,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/configuration",
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")
@ -82,6 +88,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.")
}) })
@Permission(scope = "device:android:event:publish", roles = {"admin"})
Response publishEvents( Response publishEvents(
@ApiParam( @ApiParam(
name = "eventBeanWrapper", name = "eventBeanWrapper",
@ -130,6 +137,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.")
}) })
@Permission(scope = "device:android:event:view", roles = {"admin"})
Response retrieveAlerts( Response retrieveAlerts(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -118,7 +118,7 @@
<overWrite>true</overWrite> <overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/ <outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/
</outputDirectory> </outputDirectory>
<destFileName>api#device-mgt#android#v1.0.war</destFileName> <destFileName>api-device-mgt-android-v1.0.war</destFileName>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
</configuration> </configuration>

@ -1,5 +1,5 @@
instructions.configure = \ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/api#device-mgt#android#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt#android#v1.0.war,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/api-device-mgt-android-v1.0.war,target:${installFolder}/../../deployment/server/webapps/api-device-mgt-android-v1.0.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\

Loading…
Cancel
Save