No applications found. " +
- "please try refreshing the list in a while.
");
+ html("
-
-
+ {{#if isAuthorized}}
+
+
+
+
-
+ {{/if}}
{{/zone}}
{{#zone "content"}}
+ {{#if isAuthorized}}
+ {{else}}
+
+ Permission Denied
+
+
+ You are not authorized to view specified device in the system.
+ {{/if}}
{{/zone}}
{{#zone "bottomJs"}}
+ {{#if isAuthorized}}
@@ -380,4 +391,5 @@
{{js "js/device-detail.js"}}
{{js "js/load-map.js"}}
+ {{/if}}
{{/zone}}
\ No newline at end of file
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.js
index fe0d3a643f..05309e1fa8 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.js
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.js
@@ -17,7 +17,7 @@
*/
function onRequest(context) {
- var log = new Log("view.js");
+ // var log = new Log("view.js");
var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id");
var deviceData = {};
@@ -26,6 +26,8 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId);
if (response["status"] == "success") {
+ deviceData["isAuthorized"] = true;
+
var device = response["content"];
var viewModel = {};
var deviceInfo = device["properties"]["DEVICE_INFO"];
@@ -54,8 +56,7 @@ function onRequest(context) {
viewModel["vendor"] = device["properties"]["VENDOR"];
var osBuildDate = device["properties"]["OS_BUILD_DATE"];
if (osBuildDate != null && osBuildDate != "0") {
- var formattedDate = new Date(osBuildDate * 1000);
- viewModel["os_build_date"] = formattedDate;
+ viewModel["os_build_date"] = new Date(osBuildDate * 1000);
}
viewModel["internal_memory"] = {};
viewModel["external_memory"] = {};
@@ -96,6 +97,8 @@ function onRequest(context) {
device["viewModel"] = viewModel;
}
deviceData["device"] = device;
+ } else if (response["status"] == "unauthorized") {
+ deviceData["isAuthorized"] = false;
}
return deviceData;
}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk
index 8f86ac5929..62abf46b6d 100644
Binary files a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk and b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk differ
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java
index 6f4ecfd76d..4d96f8acd3 100644
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java
@@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
+import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import javax.ws.rs.*;
@@ -35,26 +36,31 @@ public interface DeviceManagementAdminService {
@POST
@Path("/lock-devices")
+ @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/windows/lock")
Response lock(@HeaderParam("Accept") String headerParam, List
deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/disenroll-devices")
+ @Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows")
Response disenroll(@HeaderParam("Accept") String headerParam, List deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/wipe-devices")
+ @Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning/operations/windows/wipe")
Response wipe(@HeaderParam("Accept") String headerParam, List deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/ring-devices")
+ @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/windows/ring")
Response ring(@HeaderParam("Accept") String headerParam, List deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/lockreset-devices")
+ @Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning/operations/windows/lockreset")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List deviceIds)
throws WindowsDeviceEnrolmentException;
}