merging changes

revert-dabc3590
Hasunie 8 years ago
commit de533a0667

@ -69,6 +69,12 @@
<!--TODO: use http://requirejs.org/ for better performance, now we have too many imports --> <!--TODO: use http://requirejs.org/ for better performance, now we have too many imports -->
<!-- C3 chart library styles--> <!-- C3 chart library styles-->
<link rel="stylesheet" href="css/d3/c3.css" type="text/css"/> <link rel="stylesheet" href="css/d3/c3.css" type="text/css"/>
<link rel="stylesheet" href="css/bootstrap-datepicker.min.css" type="text/css"/>
<style>
.datepicker-inline {
margin:0 auto;
}
</style>
<!-- JAVASCRIPT --> <!-- JAVASCRIPT -->
@ -85,7 +91,17 @@
<script src="js/jquery/jquery-2.1.1.min.js"></script> <script src="js/jquery/jquery-2.1.1.min.js"></script>
<script src="js/jquery/jquery-ui.min.js"></script> <script src="js/jquery/jquery-ui.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/bootstrap-datepicker.min.js"></script>
<script>
$(function() {
$("#timeFrom").datepicker({
orientation: 'top'
});
$("#timeTo").datepicker({
orientation: 'top'
});
});
</script>
<!--bootstrap-application-wizard--> <!--bootstrap-application-wizard-->
<script src="js/bootstrap-wizard-lib/bootstrap-wizard.js"></script> <script src="js/bootstrap-wizard-lib/bootstrap-wizard.js"></script>

@ -327,25 +327,31 @@ function notifyError(message) {
function enableRealTime() { function enableRealTime() {
document.getElementById('realTimeShow').style.display = 'none'; document.getElementById('realTimeShow').style.display = 'none';
spatialObject = currentSpatialObjects[selectedSpatialObject]; spatialObject = currentSpatialObjects[selectedSpatialObject];
if (spatialObject) {
spatialObject.removePath(); spatialObject.removePath();
spatialObject.marker.closePopup(); spatialObject.marker.closePopup();
}
selectedSpatialObject = null; selectedSpatialObject = null;
clearFocus(); clearFocus();
clearMap(); clearMap();
document.getElementById('objectInfo').style.display = 'none'; document.getElementById('objectInfo').style.display = 'none';
isBatchModeOn = false; isBatchModeOn = false;
} }
function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) { function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
if (!timeFrom) { if (!timeFrom) {
notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom); notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom);
} else if (!timeTo) { } else if (!timeTo) {
notifyError('No end time provided to show history. Please provide a suitable value' + timeTo); notifyError('No end time provided to show history. Please provide a suitable value' + timeTo);
} else { } else {
$('#dateRangePopup').dialog('close');
document.getElementById('realTimeShow').style.display = 'block'; document.getElementById('realTimeShow').style.display = 'block';
isBatchModeOn = true; isBatchModeOn = true;
clearFocus(); // Clear current focus if any clearFocus(); // Clear current focus if any
clearMap(); clearMap();
var tableData = getProviderData(timeFrom, timeTo); var fromDate = new Date(timeFrom);
var toDate = new Date(timeTo);
var tableData = getProviderData(fromDate.valueOf() / 1000, toDate.valueOf() / 1000);
for (var i = 0; i < tableData.length; i++) { for (var i = 0; i < tableData.length; i++) {
var data = tableData[i]; var data = tableData[i];
var geoMessage = { var geoMessage = {
@ -401,7 +407,6 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
createChart(); createChart();
chart.load({columns: [spatialObject.speedHistory.getArray()]}); chart.load({columns: [spatialObject.speedHistory.getArray()]});
}, 100); }, 100);
$('#dateRangePopup').dialog('close');
} }
} }

@ -153,6 +153,10 @@
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
</dependency>
</dependencies> </dependencies>

@ -19,14 +19,13 @@
package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; package org.wso2.carbon.device.mgt.iot.androidsense.service.impl;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
@ -44,6 +43,16 @@ import javax.ws.rs.core.Response;
@Tag(name = "android_sense", description = "") @Tag(name = "android_sense", description = "")
} }
) )
@Scopes(
scopes = {
@Scope(
name = "Enroll device",
description = "",
key = "perm:android-sense:enroll",
permissions = {"/device-mgt/devices/enroll/android-sense"}
)
}
)
public interface AndroidSenseService { public interface AndroidSenseService {
/** /**
@ -54,7 +63,19 @@ public interface AndroidSenseService {
*/ */
@Path("device/{deviceId}/words") @Path("device/{deviceId}/words")
@POST @POST
@Scope(key = "device:android-sense:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Send the key words to the device",
notes = "",
response = Response.class,
tags = "android_sense",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
})
}
)
Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords);
/** /**
@ -65,12 +86,36 @@ public interface AndroidSenseService {
*/ */
@Path("device/{deviceId}/words/threshold") @Path("device/{deviceId}/words/threshold")
@POST @POST
@Scope(key = "device:android-sense:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Send threshold value to the device",
notes = "",
response = Response.class,
tags = "android_sense",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
})
}
)
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
@Scope(key = "device:android-sense:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Remove key words from the device",
notes = "",
response = Response.class,
tags = "android_sense",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
})
}
)
Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words);
/** /**
@ -79,8 +124,20 @@ public interface AndroidSenseService {
@Path("stats/{deviceId}/sensors/{sensorName}") @Path("stats/{deviceId}/sensors/{sensorName}")
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Scope(key = "device:android-sense:enroll", name = "", description = "")
@Produces("application/json") @Produces("application/json")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Retrieve Sensor data for the device type",
notes = "",
response = Response.class,
tags = "android_sense",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
})
}
)
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);
@ -89,7 +146,19 @@ public interface AndroidSenseService {
*/ */
@Path("device/{device_id}/register") @Path("device/{device_id}/register")
@POST @POST
@Scope(key = "device:android-sense:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Enroll device",
notes = "",
response = Response.class,
tags = "android_sense",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
})
}
)
Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName);
} }

@ -42,4 +42,6 @@ public class AndroidSenseConstants {
public static final String CONFIG_TYPE = "general"; public static final String CONFIG_TYPE = "general";
public static final String DEFAULT_ENDPOINT = "tcp://localhost:1886"; public static final String DEFAULT_ENDPOINT = "tcp://localhost:1886";
public static final String SCOPE = "scope";
} }

@ -43,6 +43,8 @@
</li> </li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" <li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li> aria-controls="event_log">Operations Log</a></li>
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
aria-controls="geo_dashboard">Map</a></li>
{{/zone}} {{/zone}}
{{#zone "device-view-tab-contents"}} {{#zone "device-view-tab-contents"}}

@ -141,6 +141,10 @@
<artifactId>org.wso2.carbon.analytics.api</artifactId> <artifactId>org.wso2.carbon.analytics.api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -18,15 +18,14 @@
package org.wso2.carbon.device.mgt.iot.arduino.service.impl; package org.wso2.carbon.device.mgt.iot.arduino.service.impl;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.iot.arduino.service.impl.constants.ArduinoConstants;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
@ -44,26 +43,72 @@ import javax.ws.rs.core.Response;
@Tag(name = "arduino", description = "") @Tag(name = "arduino", description = "")
} }
) )
@Scopes(
scopes = {
@Scope(
name = "Enroll device",
description = "",
key = "perm:arduino:enroll",
permissions = {"/device-mgt/devices/enroll/arduino"}
)
}
)
public interface ArduinoService { public interface ArduinoService {
@Path("device/{deviceId}/bulb") @Path("device/{deviceId}/bulb")
@POST @POST
@Scope(key = "device:arduino:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Switch bulb",
notes = "",
response = Response.class,
tags = "arduino",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
})
}
)
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
@Scope(key = "device:arduino:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Read controls",
notes = "",
response = Response.class,
tags = "arduino",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
})
}
)
Response readControls(@PathParam("deviceId") String deviceId); Response readControls(@PathParam("deviceId") String deviceId);
/** /**
* Retreive Sensor data for the device type * Retrieve Sensor data for the device type
*/ */
@Path("device/stats/{deviceId}") @Path("device/stats/{deviceId}")
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
@Scope(key = "device:arduino:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Retrieve Sensor data for the device type",
notes = "",
response = Response.class,
tags = "arduino",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
})
}
)
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);
@ -73,7 +118,19 @@ public interface ArduinoService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces("application/octet-stream") @Produces("application/octet-stream")
@Scope(key = "device:arduino:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Download device agent",
notes = "",
response = Response.class,
tags = "arduino",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
})
}
)
Response downloadSketch(@QueryParam("deviceName") String customDeviceName); Response downloadSketch(@QueryParam("deviceName") String customDeviceName);
} }

@ -27,4 +27,6 @@ public class ArduinoConstants {
public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600"; public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600";
public static final String SCOPE = "scope";
} }

@ -44,6 +44,8 @@
</li> </li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" <li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li> aria-controls="event_log">Operations Log</a></li>
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
aria-controls="geo_dashboard">Map</a></li>
{{/zone}} {{/zone}}
{{#zone "device-view-tab-contents"}} {{#zone "device-view-tab-contents"}}

@ -121,6 +121,10 @@
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
</dependency>
</dependencies> </dependencies>

@ -18,12 +18,10 @@
package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl; package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl.constants.RaspberrypiConstants;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -44,11 +42,33 @@ import javax.ws.rs.core.Response;
@Tag(name = "raspberrypi", description = "") @Tag(name = "raspberrypi", description = "")
} }
) )
@Scopes(
scopes = {
@Scope(
name = "Enroll device",
description = "",
key = "perm:raspberrypi:enroll",
permissions = {"/device-mgt/devices/enroll/raspberrypi"}
)
}
)
public interface RaspberryPiService { public interface RaspberryPiService {
@Path("device/{deviceId}/bulb") @Path("device/{deviceId}/bulb")
@POST @POST
@Scope(key = "device:raspberrypi:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Switch bulb",
notes = "",
response = Response.class,
tags = "raspberrypi",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
})
}
)
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
/** /**
@ -58,7 +78,19 @@ public interface RaspberryPiService {
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
@Scope(key = "device:raspberrypi:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Retreive Sensor data for the device type",
notes = "",
response = Response.class,
tags = "raspberrypi",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
})
}
)
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);
@ -68,7 +100,19 @@ public interface RaspberryPiService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Scope(key = "device:raspberrypi:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Download the agent.",
notes = "",
response = Response.class,
tags = "raspberrypi",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
})
}
)
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType);
} }

@ -33,4 +33,6 @@ public class RaspberrypiConstants {
public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600"; public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600";
public static final String SCOPE = "scope";
} }

@ -44,6 +44,8 @@
</li> </li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" <li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li> aria-controls="event_log">Operations Log</a></li>
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
aria-controls="geo_dashboard">Map</a></li>
{{/zone}} {{/zone}}
{{#zone "device-view-tab-contents"}} {{#zone "device-view-tab-contents"}}

@ -240,6 +240,10 @@
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

@ -18,14 +18,12 @@
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.*;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
@ -50,8 +48,20 @@ import javax.ws.rs.core.Response;
@Tag(name = "virtual_firealarm", description = "") @Tag(name = "virtual_firealarm", description = "")
} }
) )
@Scopes(
scopes = {
@Scope(
name = "Enroll device",
description = "",
key = "perm:firealarm:enroll",
permissions = {"/device-mgt/devices/enroll/firealarm"}
)
}
)
public interface VirtualFireAlarmService { public interface VirtualFireAlarmService {
String SCOPE = "scope";
/** /**
* This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to * This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to
* the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used * the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used
@ -63,7 +73,19 @@ public interface VirtualFireAlarmService {
*/ */
@POST @POST
@Path("device/{deviceId}/buzz") @Path("device/{deviceId}/buzz")
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Switch Buzzer",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
Response switchBuzzer(@PathParam("deviceId") String deviceId, Response switchBuzzer(@PathParam("deviceId") String deviceId,
@FormParam("state") String state); @FormParam("state") String state);
@ -72,7 +94,19 @@ public interface VirtualFireAlarmService {
*/ */
@Path("device/stats/{deviceId}") @Path("device/stats/{deviceId}")
@GET @GET
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Retrieve Sensor data for the device type",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
@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,
@ -81,7 +115,19 @@ public interface VirtualFireAlarmService {
@Path("device/download") @Path("device/download")
@GET @GET
@Produces("application/zip") @Produces("application/zip")
@Scope(key = "device:firealarm:enroll", name = "", description = "") @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Download agent",
notes = "",
response = Response.class,
tags = "virtual_firealarm",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
})
}
)
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
} }

@ -143,6 +143,11 @@
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>

@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension; import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag; import io.swagger.annotations.Tag;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
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.*;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid; import javax.validation.Valid;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -64,6 +65,160 @@ import java.util.List;
@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)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Scopes(
scopes = {
@Scope(
name = "Lock Device",
description = "Hard lock own device",
key = "perm:android:lock-devices",
permissions = {"/device-mgt/devices/owning-device/operations/android/lock"}
),
@Scope(
name = "Unlock Device",
description = "Unlock permanently locked device",
key = "perm:android:unlock-devices",
permissions = {"/device-mgt/devices/owning-device/operations/android/unlock"}
),
@Scope(
name = "Get Location",
description = "Request device location coordinates",
key = "perm:android:location",
permissions = {"/device-mgt/devices/owning-device/operations/android/location"}
),
@Scope(
name = "Clear Password",
description = "Clear the password on Android devices",
key = "perm:android:clear-password",
permissions = {"/device-mgt/devices/owning-device/operations/android/clear-password"}
),
@Scope(
name = "Control Camera",
description = "Enabling or Disabling the Camera on Android Devices",
key = "perm:android:control-camera",
permissions = {"/device-mgt/devices/owning-device/operations/android/camera"}
),
@Scope(
name = "Get Info",
description = "Requesting device information from Android Devices",
key = "perm:android:info",
permissions = {"/device-mgt/devices/owning-device/operations/android/info"}
),
@Scope(
name = "Get Logs",
description = "Requesting Logcat Details from Android Devices",
key = "perm:android:logcat",
permissions = {"/device-mgt/devices/owning-device/operations/android/logcat"}
),
@Scope(
name = "Enterprise Wipe",
description = "Enterprise Wiping Android Devices",
key = "perm:android:enterprise-wipe",
permissions = {"/device-mgt/devices/owning-device/operations/android/enterprise-wipe"}
),
@Scope(
name = "Factory Reset",
description = "Factory Resetting Android Devices",
key = "perm:android:wipe",
permissions = {"/device-mgt/devices/owning-device/operations/android/wipe"}
),
@Scope(
name = "Get Installed Applications",
description = "Get list of installed applications",
key = "perm:android:applications",
permissions = {"/device-mgt/devices/owning-device/operations/android/applications"}
),
@Scope(
name = "Ring Device",
description = "Ring Android devices",
key = "perm:android:ring",
permissions = {"/device-mgt/devices/owning-device/operations/android/ring"}
),
@Scope(
name = "Reboot Device",
description = "Reboot Android devices",
key = "perm:android:reboot",
permissions = {"/device-mgt/devices/owning-device/operations/android/reboot"}
),
@Scope(
name = "Mute Device",
description = "Mute Android devices",
key = "perm:android:mute",
permissions = {"/device-mgt/devices/owning-device/operations/android/mute"}
),
@Scope(
name = "Install Applications",
description = "Installing an Application on Android Devices",
key = "perm:android:install-application",
permissions = {"/device-mgt/devices/owning-device/operations/android/install-app"}
),
@Scope(
name = "Update Applications",
description = "Updating an Application on Android Devices",
key = "perm:android:update-application",
permissions = {"/device-mgt/devices/owning-device/operations/android/update-app"}
),
@Scope(
name = "Uninstall Applications",
description = "Uninstalling an Application on Android Devices",
key = "perm:android:uninstall-application",
permissions = {"/device-mgt/devices/owning-device/operations/android/uninstall-app"}
),
@Scope(
name = "Blacklist Applications",
description = "Blacklisting applications on Android Devices",
key = "perm:android:blacklist-applications",
permissions = {"/device-mgt/devices/owning-device/operations/android/blacklist-app"}
),
@Scope(
name = "Upgrade Firmware",
description = "Upgrading Firmware of Android Devices",
key = "perm:android:upgrade-firmware",
permissions = {"/device-mgt/devices/owning-device/operations/android/upgrade"}
),
@Scope(
name = "Configure VPN",
description = "Configure VPN on Android Device",
key = "perm:android:configure-vpn",
permissions = {"/device-mgt/devices/owning-device/operations/android/vpn"}
),
@Scope(
name = "Send Notification",
description = "Sending a notification to Android Device",
key = "perm:android:send-notification",
permissions = {"/device-mgt/devices/owning-device/operations/android/send-notification"}
),
@Scope(
name = "Configure Wi-Fi",
description = "Configure Wi-Fi on Android Device",
key = "perm:android:configure-wifi",
permissions = {"/device-mgt/devices/owning-device/operations/android/wifi"}
),
@Scope(
name = "Encrypt Storage",
description = "Encrypting storage on Android Device",
key = "perm:android:encrypt-storage",
permissions = {"/device-mgt/devices/owning-device/operations/android/encrypt"}
),
@Scope(
name = "Change Password",
description = "Changing the lock code of an Android Device",
key = "perm:android:change-lock-code",
permissions = {"/device-mgt/devices/owning-device/operations/android/change-lock-code"}
),
@Scope(
name = "Password Policy",
description = "Set password policy of an Android Device",
key = "perm:android:set-password-policy",
permissions = {"/device-mgt/devices/owning-device/operations/android/password-policy"}
),
@Scope(
name = "Add Web clip",
description = "Setting a Web Clip on Android Devices",
key = "perm:android:set-webclip",
permissions = {"/device-mgt/devices/owning-device/operations/android/webclip"}
)
}
)
public interface DeviceManagementAdminService { public interface DeviceManagementAdminService {
@POST @POST
@ -76,13 +231,10 @@ public interface DeviceManagementAdminService {
"permanently locks the device or screen locking an Android device.", "permanently locks the device or screen locking an Android device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:lock-devices")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/lock",
description = "Lock Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -142,13 +294,10 @@ public interface DeviceManagementAdminService {
notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.", notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:unlock-devices")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/unlock",
description = "Unlock Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -208,13 +357,10 @@ public interface DeviceManagementAdminService {
"Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.", "Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:location")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/location",
description = "Get Device Location") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -270,13 +416,10 @@ public interface DeviceManagementAdminService {
notes = "Clear the password on Android devices", notes = "Clear the password on Android devices",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service.", tags = "Android Device Management Administrative Service.",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:clear-password")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/clear-password",
description = "Clear Password of Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -331,13 +474,11 @@ public interface DeviceManagementAdminService {
notes = "Enable or disable the camera on Android devices.", notes = "Enable or disable the camera on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:control-camera")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/operations/android/camera", description = "Manage Camera") } })
) } )
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
@ -398,13 +539,10 @@ public interface DeviceManagementAdminService {
"the list of operations that needs to be executed on the device", "the list of operations that needs to be executed on the device",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:info")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/info",
description = "Get Device Information") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -464,13 +602,10 @@ public interface DeviceManagementAdminService {
"the list of operations that needs to be executed on the device.", "the list of operations that needs to be executed on the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:logcat")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/logcat",
description = "Get Logs") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -529,13 +664,10 @@ public interface DeviceManagementAdminService {
"personal data intact. You are able to enterprise wipe Android devices using this REST API.", "personal data intact. You are able to enterprise wipe Android devices using this REST API.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enterprise-wipe")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe",
description = "Enterprise Wipe") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -592,13 +724,10 @@ public interface DeviceManagementAdminService {
"to restore them back to the original system.", "to restore them back to the original system.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:wipe")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/wipe",
description = "Factory Reset") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -659,13 +788,10 @@ public interface DeviceManagementAdminService {
"on the device.", "on the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:applications")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/applications",
description = "Get Installed Application") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -722,13 +848,10 @@ public interface DeviceManagementAdminService {
notes = "Ring Android devices.", notes = "Ring Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:ring")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/ring",
description = "Ring Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -785,13 +908,10 @@ public interface DeviceManagementAdminService {
notes = "Reboot or restart your Android devices.", notes = "Reboot or restart your Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:reboot")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/reboot",
description = "Reboot Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -840,6 +960,7 @@ public interface DeviceManagementAdminService {
List<String> deviceIDs); List<String> deviceIDs);
@POST @POST
@Path("/mute")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
@ -847,13 +968,10 @@ public interface DeviceManagementAdminService {
notes = "Mute or enable a silent profile for Android devices.", notes = "Mute or enable a silent profile for Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:mute")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/mute",
description = "Mute Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -894,7 +1012,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device mute operation.") "Server error occurred while adding a new device mute operation.")
}) })
@Path("/mute")
Response muteDevice( Response muteDevice(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -913,13 +1030,10 @@ public interface DeviceManagementAdminService {
" the application installation will happen in silent mode, else the device user's consent will be required.", " the application installation will happen in silent mode, else the device user's consent will be required.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:install-application")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/install-app",
description = "Install Applications") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -981,13 +1095,10 @@ public interface DeviceManagementAdminService {
"mode, else the device user's consent is required.", "mode, else the device user's consent is required.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:update-application")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/update-app",
description = "Update installed applications") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1046,13 +1157,10 @@ public interface DeviceManagementAdminService {
notes = "Uninstall an application from Android devices.", notes = "Uninstall an application from Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:uninstall-application")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/uninstall-app",
description = "Uninstall Applications") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1115,13 +1223,10 @@ public interface DeviceManagementAdminService {
"COPE devices. Applications can be blacklisted via the application restriction policy too.", "COPE devices. Applications can be blacklisted via the application restriction policy too.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:blacklist-applications")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/blacklist-app",
description = "Blacklist Applications") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1176,17 +1281,14 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "UUpgrading Firmware of Android Devices", value = "Upgrading Firmware of Android Devices",
notes = "Upgrade the firmware of Android devices.", notes = "Upgrade the firmware of Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:upgrade-firmware")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/upgrade",
description = "Upgrade Firmware") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1247,13 +1349,10 @@ public interface DeviceManagementAdminService {
notes = "Configure VPN on Android devices.", notes = "Configure VPN on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-vpn")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/vpn",
description = "Add VPN") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1310,13 +1409,10 @@ public interface DeviceManagementAdminService {
notes = "Send a notification or message to Android devices.", notes = "Send a notification or message to Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:send-notification")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/send-notification",
description = "Send Notifications") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1374,13 +1470,10 @@ public interface DeviceManagementAdminService {
notes = "Configure Wi-Fi on Android devices.", notes = "Configure Wi-Fi on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-wifi")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/wifi",
description = "Add Wifi Configuration") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1439,13 +1532,10 @@ public interface DeviceManagementAdminService {
notes = "Encrypt the data stored on Android devices.", notes = "Encrypt the data stored on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:encrypt-storage")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/encrypt",
description = "Encrypt Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1504,13 +1594,10 @@ public interface DeviceManagementAdminService {
notes = "Change the lock code on Android devices.", notes = "Change the lock code on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:change-lock-code")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/change-lock-code",
description = "Change Password of Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1569,13 +1656,10 @@ public interface DeviceManagementAdminService {
notes = "Set a password policy on Android devices.", notes = "Set a password policy on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-password-policy")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/password-policy",
description = "Set Password Policy") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -1624,7 +1708,7 @@ public interface DeviceManagementAdminService {
PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); PasswordPolicyBeanWrapper passwordPolicyBeanWrapper);
@POST @POST
@Path("set-webclip") @Path("/set-webclip")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
@ -1632,13 +1716,10 @@ public interface DeviceManagementAdminService {
notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.", notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-webclip")
scopes = { @AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/android/webclip",
description = "Add Webclips") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {

@ -18,22 +18,14 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import org.wso2.carbon.apimgt.annotations.api.Scope;
import io.swagger.annotations.ApiResponse; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Extension;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Info;
import io.swagger.annotations.ResponseHeader;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
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;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -72,6 +64,22 @@ import java.util.List;
@Path("/devices") @Path("/devices")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Scopes(
scopes = {
@Scope(
name = "Enroll Device",
description = "Register an Android device",
key = "perm:android:enroll",
permissions = {"/device-mgt/devices/enroll/android"}
),
@Scope(
name = "Un-enroll Device",
description = "Unregister an Android device",
key = "perm:android:disenroll",
permissions = {"/device-mgt/devices/disenroll/android"}
)
}
)
public interface DeviceManagementService { public interface DeviceManagementService {
@PUT @PUT
@ -83,12 +91,10 @@ public interface DeviceManagementService {
value = "Updating the Application Details on Android Devices", value = "Updating the Application Details on Android Devices",
notes = "Update the details of the applications that are installed on Android devices.", notes = "Update the details of the applications that are installed on Android devices.",
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -150,12 +156,10 @@ public interface DeviceManagementService {
"The server then updates the status of the operations that were carried out on the device.", "The server then updates the status of the operations that were carried out on the device.",
response = Operation.class, response = Operation.class,
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -216,12 +220,10 @@ public interface DeviceManagementService {
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
" an Android Agent. This API can be mainly used to test the device enrollment process.", " an Android Agent. This API can be mainly used to test the device enrollment process.",
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -273,12 +275,10 @@ public interface DeviceManagementService {
value = "Getting the Registration Status of an Android Device", value = "Getting the Registration Status of an Android Device",
notes = "Use this REST API to retrieve the registration status of an Android device.", notes = "Use this REST API to retrieve the registration status of an Android device.",
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -328,12 +328,10 @@ public interface DeviceManagementService {
value = "Updating the Registration Details of an Android Device", value = "Updating the Registration Details of an Android Device",
notes = "Use this REST API to update the registration details of an Android device.", notes = "Use this REST API to update the registration details of an Android device.",
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses( @ApiResponses(
@ -386,11 +384,10 @@ public interface DeviceManagementService {
value = "Unregistering an Android Device", value = "Unregistering an Android Device",
notes = "Use this REST API to unregister an Android device.", notes = "Use this REST API to unregister an Android device.",
tags = "Android Device Management", tags = "Android Device Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:disenroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/disenroll/android", description = "Disenroll Device") } })
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {

@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension; import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag; import io.swagger.annotations.Tag;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
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;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid; import javax.validation.Valid;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -61,6 +62,28 @@ import javax.ws.rs.core.Response;
@Path("/configuration") @Path("/configuration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Scopes(
scopes = {
@Scope(
name = "Enroll Device",
description = "Register an Android device",
key = "perm:android:enroll",
permissions = {"/device-mgt/devices/enroll/android"}
),
@Scope(
name = "View Configurations",
description = "Getting Android Platform Configurations",
key = "perm:android:view-configuration",
permissions = {"/device-mgt/platform-configurations/view"}
),
@Scope(
name = "Manage Configurations",
description = "Updating Android Platform Configurations",
key = "perm:android:manage-configuration",
permissions = {"/device-mgt/platform-configurations/manage"}
)
}
)
public interface DeviceTypeConfigurationService { public interface DeviceTypeConfigurationService {
@GET @GET
@ -71,12 +94,10 @@ public interface DeviceTypeConfigurationService {
notes = "Get the Android platform configuration details using this REST API.", notes = "Get the Android platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Android Configuration Management", tags = "Android Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:view-configuration")
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view", })
description = "View Configurations") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -127,12 +148,10 @@ public interface DeviceTypeConfigurationService {
value = "Updating Android Platform Configurations", value = "Updating Android Platform Configurations",
notes = "Update the Android platform configurations using this REST API.", notes = "Update the Android platform configurations using this REST API.",
tags = "Android Configuration Management", tags = "Android Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:manage-configuration")
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/manage", })
description = "Manage Configurations") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -184,12 +203,10 @@ public interface DeviceTypeConfigurationService {
"registration process.", "registration process.",
response = String.class, response = String.class,
tags = "Android Configuration Management", tags = "Android Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Enroll Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {

@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension; import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag; import io.swagger.annotations.Tag;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
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;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -61,6 +62,16 @@ import javax.ws.rs.core.Response;
@Path("/events") @Path("/events")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Scopes(
scopes = {
@Scope(
name = "Enroll Device",
description = "Register an Android device",
key = "perm:android:enroll",
permissions = {"/device-mgt/devices/enroll/android"}
)
}
)
public interface EventReceiverService { public interface EventReceiverService {
@POST @POST
@ -72,12 +83,10 @@ public interface EventReceiverService {
value = "Publishing Events", value = "Publishing Events",
notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.", notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.",
tags = "Event Receiver", tags = "Event Receiver",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Publish Events to DAS") }
)
} }
) )
@ApiResponses( @ApiResponses(
@ -137,12 +146,10 @@ public interface EventReceiverService {
response = DeviceState.class, response = DeviceState.class,
responseContainer = "List", responseContainer = "List",
tags = "Event Receiver", tags = "Event Receiver",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value="permission", @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android", })
description = "Publish Events to DAS") }
)
} }
) )
@ApiResponses( @ApiResponses(

@ -26,6 +26,7 @@ public final class AndroidConstants {
public static final String DEVICE_TYPE_ANDROID = "android"; public static final String DEVICE_TYPE_ANDROID = "android";
public static final String HEADER_CONTENT_TYPE = "Content-Type"; public static final String HEADER_CONTENT_TYPE = "Content-Type";
public static final String APPLICATION_JSON = "application/json"; public static final String APPLICATION_JSON = "application/json";
public static final String SCOPE = "scope";
public final class DeviceProperties { public final class DeviceProperties {
private DeviceProperties() { private DeviceProperties() {

@ -38,9 +38,9 @@ under the License. --}}
<div class="row"> <div class="row">
<div class="col-md-4 wr-text"> <div class="col-md-4 wr-text">
If you have not already enrolled this device with {{companyName}}, If you have not already enrolled this device with {{companyName}},
Download and install following EMM Agent to continue. Download and install following IoT Server Agent to continue.
<div class="wr-buttons"> <div class="wr-buttons">
<a href="{{agentDownloadURL}}" class="btn-download-agent">Download EMM Agent</a> <a href="{{agentDownloadURL}}" class="btn-download-agent">Download IoT Server Agent</a>
</div> </div>
</div> </div>
</div> </div>

@ -28,7 +28,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="android-config-notifier"> <label class="wr-input-label" for="android-config-notifier">
Type of Communication Type of Communication
<span class="helper" title="Communication method of android agent to contact EMM server"> <span class="helper" title="Communication method of android agent to contact IoT Server">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
</label> </label>
@ -42,7 +42,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="android-config-notifier-frequency"> <label class="wr-input-label" for="android-config-notifier-frequency">
Polling Interval* Polling Interval*
<span class="helper" title="Time interval after which Android agent will contact EMM server each time to fetch data"> <span class="helper" title="Time interval after which Android agent will contact IoT Server each time to fetch data">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>

@ -1137,7 +1137,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days"> <label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
Profile Name Profile Name
<span class="helper" title="Name of the Work-Profile created by EMM Agent"> <span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>

@ -1243,7 +1243,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days"> <label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
Profile Name Profile Name
<span class="helper" title="Name of the Work-Profile created by EMM Agent"> <span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>

@ -1137,7 +1137,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days"> <label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
Profile Name Profile Name
<span class="helper" title="Name of the Work-Profile created by EMM Agent"> <span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>

@ -79,6 +79,8 @@ public class Constants {
public static final String META_FORMAT_INT = "int"; public static final String META_FORMAT_INT = "int";
public static final String META_FORMAT_CHARACTER = "chr"; public static final String META_FORMAT_CHARACTER = "chr";
public static final String SCOPE = "scope";
/** /**
* SynclML service related constants. * SynclML service related constants.
*/ */

@ -32,9 +32,12 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -66,8 +69,30 @@ import javax.ws.rs.core.Response;
description = "This carries all the resources related to Windows configurations management functionality") description = "This carries all the resources related to Windows configurations management functionality")
@WebService @WebService
@Path("/configuration") @Path("/configuration")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({"application/json", "application/xml"})
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({"application/json", "application/xml"})
@Scopes(
scopes = {
@Scope(
name = "Enroll Device",
description = "Register an Windows device",
key = "perm:windows:enroll",
permissions = {"/device-mgt/devices/enroll/windows"}
),
@Scope(
name = "View Configurations",
description = "Getting Windows Platform Configurations",
key = "perm:windows:view-configuration",
permissions = {"/device-mgt/platform-configurations/view"}
),
@Scope(
name = "Manage Configurations",
description = "Updating Windows Platform Configurations",
key = "perm:windows:manage-configuration",
permissions = {"/device-mgt/platform-configurations/manage"}
)
}
)
public interface ConfigurationMgtService { public interface ConfigurationMgtService {
@GET @GET
@ -78,12 +103,10 @@ public interface ConfigurationMgtService {
notes = "Get the Windows platform configuration details using this REST API.", notes = "Get the Windows platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:view-configuration")
scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view", })
description = "View Configurations")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -139,12 +162,10 @@ public interface ConfigurationMgtService {
value = "Updating Windows Platform Configurations", value = "Updating Windows Platform Configurations",
notes = "Update the Windows platform configurations using this REST API.", notes = "Update the Windows platform configurations using this REST API.",
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:manage-configuration")
scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage", })
description = "Manage Configurations")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -197,12 +218,10 @@ public interface ConfigurationMgtService {
"registration process.", "registration process.",
response = String.class, response = String.class,
tags = "Windows Configuration Management", tags = "Windows Configuration Management",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll")
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", })
description = "Enroll Device")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {

@ -19,9 +19,12 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -52,15 +55,61 @@ import java.util.List;
} }
), ),
tags = { tags = {
@Tag(name = "windows", description = "") @Tag(name = "devicemgt_windows", description = "")
} }
) )
@Api(value = "Windows Device Management Administrative Service", @Api(value = "Windows Device Management Administrative Service",
description = "Device management related admin APIs.") description = "Device management related admin APIs.")
@WebService @WebService
@Path("/operation/admin/devices") @Path("/admin/devices")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces(MediaType.APPLICATION_JSON)
@Scopes(
scopes = {
@Scope(
name = "Lock Device",
description = "Adding a Device Lock on Windows devices.",
key = "perm:windows:lock-devices",
permissions = {"/device-mgt/devices/owning-device/operations/windows/lock"}
),
@Scope(
name = "Un-enroll Device",
description = "Unregister an Windows device",
key = "perm:windows:disenroll",
permissions = {"/device-mgt/devices/disenroll/windows"}
),
@Scope(
name = "Factory Reset",
description = "Factory Resetting Windows Devices",
key = "perm:windows:wipe",
permissions = {"/device-mgt/devices/owning-device/operations/windows/wipe"}
),
@Scope(
name = "Ring Device",
description = "Ring Windows devices",
key = "perm:windows:ring",
permissions = {"/device-mgt/devices/owning-device/operations/windows/ring"}
),
@Scope(
name = "Lock Reset",
description = "Lock reset on Windows devices",
key = "perm:windows:lock-reset",
permissions = {"/device-mgt/devices/owning-device/operations/windows/lock-reset"}
),
@Scope(
name = "Reboot",
description = "Lock reset on Windows devices",
key = "perm:windows:reboot",
permissions = {"/device-mgt/devices/owning-device/operations/windows/reboot"}
),
@Scope(
name = "Device Location",
description = "Lock reset on Windows devices",
key = "perm:windows:location",
permissions = {"/device-mgt/devices/owning-device/operations/windows/location"}
)
}
)
public interface DeviceManagementAdminService { public interface DeviceManagementAdminService {
@POST @POST
@ -72,13 +121,10 @@ public interface DeviceManagementAdminService {
notes = "Using this API you have the option of Device Windows device.", notes = "Using this API you have the option of Device Windows device.",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-devices")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/windows/lock",
description = "Lock Device")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -134,13 +180,10 @@ public interface DeviceManagementAdminService {
notes = "Dis-enroll on Android devices", notes = "Dis-enroll on Android devices",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service.", tags = "Windows Device Management Administrative Service.",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:disenroll")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/disenroll/windows",
description = "Dis-enroll the windows devices ")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -198,13 +241,10 @@ public interface DeviceManagementAdminService {
"to restore them back to the original system.", "to restore them back to the original system.",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:wipe")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/windows/wipe",
description = "DeviceWipe")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -259,13 +299,10 @@ public interface DeviceManagementAdminService {
notes = "Ring Windows devices.", notes = "Ring Windows devices.",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:ring")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/windows/ring",
description = "Ring Device")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -321,13 +358,10 @@ public interface DeviceManagementAdminService {
notes = "Lock reset on Windows devices.Its use to reset the device pass code", notes = "Lock reset on Windows devices.Its use to reset the device pass code",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-reset")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/windows/lock-reset",
description = "Lock reset")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -386,13 +420,11 @@ public interface DeviceManagementAdminService {
"you can use this REST API to get the location of the device.", "you can use this REST API to get the location of the device.",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:location")
scopes = {@AuthorizationScope( })
scope = "/device-mgt/devices/owning-device/operations/windows/location",
description = "Get Device Location")}
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -451,13 +483,12 @@ public interface DeviceManagementAdminService {
notes = "Reboot or restart your Windows devices.", notes = "Reboot or restart your Windows devices.",
response = Activity.class, response = Activity.class,
tags = "Windows Device Management Administrative Service", tags = "Windows Device Management Administrative Service",
authorizations = {
@Authorization( extensions = {
value="permission", @Extension(properties = {
scopes = { @AuthorizationScope( @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:reboot")
scope = "/device-mgt/devices/owning-device/operations/windows/reboot", })
description = "Reboot Device") }
)
} }
) )
@ApiResponses(value = { @ApiResponses(value = {
@ -504,4 +535,6 @@ public interface DeviceManagementAdminService {
value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ",
required = true) required = true)
List<String> deviceIDs); List<String> deviceIDs);
} }

@ -19,8 +19,11 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst; package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials;
import javax.jws.WebService; import javax.jws.WebService;
@ -57,12 +60,21 @@ import javax.ws.rs.core.Response;
@Path("/bst") @Path("/bst")
@Produces({"application/json", "application/xml"}) @Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"})
@Scopes(
scopes = {
@Scope(
name = "Enroll Device",
description = "Register Windows device",
key = "perm:windows:enroll",
permissions = {"/device-mgt/devices/enroll/windows"}
)
}
)
public interface BSTProvider { public interface BSTProvider {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/authentication") @Path("/authentication")
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
@ -70,13 +82,10 @@ public interface BSTProvider {
value = "Getting Binary security token.", value = "Getting Binary security token.",
notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.", notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.",
tags = "BST Provider", tags = "BST Provider",
authorizations = { extensions = {
@Authorization( @Extension(properties = {
value = "permission", @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll")
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", })
description = "Getting Binary security token for Windows enrollment " +
"and policy endpoints.")}
)
} }
) )
@ApiResponses( @ApiResponses(

@ -29,7 +29,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="windows-config-notifier-frequency"> <label class="wr-input-label" for="windows-config-notifier-frequency">
Polling Interval* Polling Interval*
<span class="helper" title="Time interval after which windows agent will contact EMM server each time to fetch data"> <span class="helper" title="Time interval after which windows agent will contact IoT Server each time to fetch data">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>

@ -1217,7 +1217,7 @@
<wso2.maven.compiler.target>1.7</wso2.maven.compiler.target> <wso2.maven.compiler.target>1.7</wso2.maven.compiler.target>
<!--Carbon kernel versions--> <!--Carbon kernel versions-->
<carbon.kernel.version>4.4.10</carbon.kernel.version> <carbon.kernel.version>4.4.11</carbon.kernel.version>
<carbon.kernel.version.range>[4.4.0, 4.5.0)</carbon.kernel.version.range> <carbon.kernel.version.range>[4.4.0, 4.5.0)</carbon.kernel.version.range>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version> <carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
@ -1267,7 +1267,7 @@
<!-- Carbon Identity --> <!-- Carbon Identity -->
<carbon.identity.framework.version>5.6.89</carbon.identity.framework.version> <carbon.identity.framework.version>5.6.89</carbon.identity.framework.version>
<identity.inbound.auth.oauth.version>5.2.33</identity.inbound.auth.oauth.version> <identity.inbound.auth.oauth.version>5.3.1</identity.inbound.auth.oauth.version>
<carbon.identity.version.range>[5.2.0, 6.0.0)</carbon.identity.version.range> <carbon.identity.version.range>[5.2.0, 6.0.0)</carbon.identity.version.range>
<!-- Carbon Multi-tenancy --> <!-- Carbon Multi-tenancy -->
@ -1280,7 +1280,7 @@
<carbon.governance.version>4.7.0</carbon.governance.version> <carbon.governance.version>4.7.0</carbon.governance.version>
<!-- Carbon API Management --> <!-- Carbon API Management -->
<carbon.api.mgt.version>6.1.2</carbon.api.mgt.version> <carbon.api.mgt.version>6.1.35</carbon.api.mgt.version>
<!-- XMPP/MQTT Version --> <!-- XMPP/MQTT Version -->
<smack.wso2.version>3.0.4.wso2v1</smack.wso2.version> <smack.wso2.version>3.0.4.wso2v1</smack.wso2.version>

Loading…
Cancel
Save