Merge remote-tracking branch 'upstream/master' into carbon-kernel-4.4.7

revert-dabc3590
Ace 8 years ago
commit 6c3ba5e688

@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
@ -93,7 +92,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new lock operation.")
})
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/android/lock")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/android/lock")
Response configureDeviceLock(
@ApiParam(name = "deviceLockBeanWrapper",
value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper);
@ -147,7 +146,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new un-lock operation.")
})
@Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning/operations/android/unlock")
@Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning-device/operations/android/unlock")
Response configureDeviceUnlock(
@ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation")
List<String> deviceIDs);
@ -200,7 +199,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-location operation.")})
@Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning/operations/android/location")
@Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning-device/operations/android/location")
Response getDeviceLocation(
@ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location")
List<String> deviceIDs);
@ -253,7 +252,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new clear password operation.")
})
@Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning/operations/android/clear-password")
@Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/clear-password")
Response removePassword(
@ApiParam(name = "deviceIDs",
value = "DeviceIds to be requested to remove password") List<String> deviceIDs);
@ -306,7 +305,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new control camera operation.")
})
@Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning/operations/android/camera")
@Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning-device/operations/android/camera")
Response configureCamera(
@ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs")
CameraBeanWrapper cameraBeanWrapper);
@ -362,7 +361,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device info operation.")
})
@Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning/operations/android/info")
@Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning-device/operations/android/info")
Response getDeviceInformation(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information")
List<String> deviceIDs);
@ -418,7 +417,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device logcat operation.")
})
@Permission(name = "Get Logs", permission = "/device-mgt/devices/owning/operations/android/logcat")
@Permission(name = "Get Logs", permission = "/device-mgt/devices/owning-device/operations/android/logcat")
Response getDeviceLogcat(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device logcat")
List<String> deviceIDs);
@ -472,7 +471,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a enterprise wipe operation.")})
@Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning/operations/android/enterprise-wipe")
@Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe")
Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe")
List<String> deviceIDs);
@ -524,7 +523,7 @@ public interface DeviceManagementAdminService {
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a device wipe operation.")})
@Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning/operations/android/wipe")
@Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning-device/operations/android/wipe")
Response wipeData(
@ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data")
WipeDataBeanWrapper wipeDataBeanWrapper);
@ -581,7 +580,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-applications operation.")
})
@Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning/operations/android/applications")
@Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning-device/operations/android/applications")
Response getApplications(
@ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed")
List<String> deviceIDs);
@ -634,7 +633,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device ring operation.")
})
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/android/ring")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/android/ring")
Response ringDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for ring")
List<String> deviceIDs);
@ -687,7 +686,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device reboot operation.")
})
@Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning/operations/android/reboot")
@Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning-device/operations/android/reboot")
Response rebootDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.")
List<String> deviceIDs);
@ -740,7 +739,7 @@ public interface DeviceManagementAdminService {
"Server error occurred while adding a new device mute operation.")
})
@Path("/mute")
@Permission(name = "Mute Device", permission = "/device-mgt/devices/owning/operations/android/mute")
@Permission(name = "Mute Device", permission = "/device-mgt/devices/owning-device/operations/android/mute")
Response muteDevice(
@ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted")
List<String> deviceIDs);
@ -796,7 +795,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new install-application operation.")
})
@Permission(name = "Install Applications", permission = "/device-mgt/devices/owning/operations/android/install-app")
@Permission(name = "Install Applications", permission = "/device-mgt/devices/owning-device/operations/android/install-app")
Response installApplication(
@ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs")
ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper);
@ -852,7 +851,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new update-application operation.")
})
@Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning/operations/android/update-app")
@Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning-device/operations/android/update-app")
Response updateApplication(
@ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs")
ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper);
@ -905,7 +904,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new uninstall-application operation.")
})
@Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning/operations/android/uninstall-app")
@Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning-device/operations/android/uninstall-app")
Response uninstallApplication(
@ApiParam(name = "applicationUninstallationBeanWrapper",
value = "applicationUninstallationConfigs and Device Ids")
@ -960,7 +959,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new blacklist-applications operation.")
})
@Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning/operations/android/blacklist-app")
@Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning-device/operations/android/blacklist-app")
Response blacklistApplications(
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
"Configuration and DeviceIds")
@ -1015,7 +1014,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new upgrade firmware operation.")
})
@Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning/operations/android/upgrade")
@Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning-device/operations/android/upgrade")
Response upgradeFirmware(
@ApiParam(name = "upgradeFirmwareBeanWrapper",
value = "Firmware upgrade configuration and DeviceIds")
@ -1070,7 +1069,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure VPN operation.")
})
@Permission(name = "Add VPN", permission = "/device-mgt/devices/owning/operations/android/vpn")
@Permission(name = "Add VPN", permission = "/device-mgt/devices/owning-device/operations/android/vpn")
Response configureVPN(
@ApiParam(name = "vpnBeanWrapper",
value = "VPN configuration and DeviceIds")
@ -1124,7 +1123,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new send notification operation.")
})
@Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning/operations/android/notification")
@Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning-device/operations/android/send-notification")
Response sendNotification(
@ApiParam(name = "notificationBeanWrapper",
value = "Notification Configurations and device Ids")
@ -1178,7 +1177,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new configure wifi operation.")
})
@Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning/operations/android/wifi")
@Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning-device/operations/android/wifi")
Response configureWifi(
@ApiParam(name = "wifiBeanWrapper",
value = "WifiConfigurations and Device Ids") WifiBeanWrapper wifiBeanWrapper);
@ -1231,7 +1230,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new encrypt storage operation.")
})
@Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning/operations/android/encrypt")
@Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning-device/operations/android/encrypt")
Response encryptStorage(
@ApiParam(name = "encryptionBeanWrapper",
value = "Configurations and deviceIds need to be done data encryption")
@ -1285,7 +1284,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new change lock code operation.")
})
@Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning/operations/android/change-lock")
@Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/change-lock-code")
Response changeLockCode(
@ApiParam(name = "lockCodeBeanWrapper",
value = "Configurations and device Ids need to be done change lock code")
@ -1339,7 +1338,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new set password policy operation.")
})
@Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning/operations/android/password-policy")
@Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning-device/operations/android/password-policy")
Response setPasswordPolicy(
@ApiParam(name = "passwordPolicyBeanWrapper",
value = "Password Policy Configurations and Device Ids")
@ -1393,7 +1392,7 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " +
"Server error occurred while adding a new set webclip operation.")
})
@Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning/operations/android/webclip")
@Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning-device/operations/android/webclip")
Response setWebClip(
@ApiParam(name = "webClipBeanWrapper",
value = "Configurations to need set web clip on device and device Ids")

@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
@ -82,7 +81,7 @@ public interface DeviceTypeConfigurationService {
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.")
})
@Permission(name = "View Configurations", permission = "/device-mgt/configurations/view")
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
Response getConfiguration(
@ApiParam(
name = "If-Modified-Since",
@ -132,7 +131,7 @@ public interface DeviceTypeConfigurationService {
message = "Internal Server Error. \n " +
"Server error occurred while modifying Android platform configuration.")
})
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
@Permission(name = "Manage Configurations", permission = "/device-mgt/platform-configurations/manage")
Response updateConfiguration(
@ApiParam(name = "configuration",
value = "AndroidPlatformConfiguration")

@ -19,8 +19,8 @@
{{unit "cdmf.unit.lib.qrcode"}}
{{unit "mdm.unit.device.qr-modal"}}
{{#zone "content"}}
<div class="row ">
{{#if permissions.LIST_DEVICES}}
<div class="row ">
<div class="col-md-3 wr-stats-board">
<div class="wr-stats-board-tile">
<div class="tile-name">Devices</div>
@ -150,8 +150,15 @@
</div>
</div>
</div>
</div>
{{/if}}
{{# if permissions.PERMITTED_NONE}}
<h1 class="page-sub-title">
Permitted None
</h1>
<br>
You are not authorized to view any of the dashboard listed resources.
{{/if}}
</div>
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/dashboard.js"}}

@ -16,24 +16,27 @@
* under the License.
*/
function onRequest(context) {
function onRequest() {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var generalConfig = context.app.conf["generalConfig"];
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var viewModel = {};
var permissions = {};
permissions.LIST_DEVICES = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
permissions.LIST_POLICIES = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions.LIST_ROLES = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions.LIST_USERS = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions.ADD_POLICY = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
permissions.ADD_ROLE = userModule.isAuthorized("/permission/admin/device-mgt/roles/manage");
permissions.ADD_USER = userModule.isAuthorized("/permission/admin/device-mgt/users/manage");
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") | userModule.isAuthorized("/permission/admin/devices/enroll/android") | userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows") ){
permissions.ENROLL_DEVICE = true;
}
viewModel.permissions = permissions;
permissions["LIST_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
permissions["ENROLL_DEVICE"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") ||
userModule.isAuthorized("/permission/admin/devices/enroll/android") ||
userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows");
permissions["LIST_POLICIES"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions["ADD_POLICY"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
permissions["LIST_USERS"] = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions["ADD_USER"] = userModule.isAuthorized("/permission/admin/device-mgt/users/manage");
permissions["LIST_ROLES"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions["ADD_ROLE"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/manage");
permissions["PERMITTED_NONE"] = !(permissions["LIST_DEVICES"] || permissions["LIST_POLICIES"] ||
permissions["LIST_USERS"] || permissions["LIST_ROLES"]);
viewModel["permissions"] = permissions;
//TODO: Move enrollment URL into app-conf.json
viewModel.enrollmentURL = mdmProps.generalConfig.host + mdmProps.enrollmentDir;
viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
return viewModel;
}

@ -53,7 +53,7 @@ $(document).ready(function () {
updateStats("/api/device-mgt/v1.0/policies?offset=0&limit=1", "#policy-count");
}
if ($("#user-count").data("user-count")) {
updateStats("/api/device-mgt/v1.0/users?offset=0&limit=1", "#user-count");
updateStats("/api/device-mgt/v1.0/users/count", "#user-count");
}
if ($("#role-count").data("role-count")) {
updateStats("/api/device-mgt/v1.0/roles?offset=0&limit=1", "#role-count");

@ -22,7 +22,7 @@ function onRequest(context){
// permission checks
// [1] checking viewing devices permission
viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
if (viewModel["isAuthorized"]) {
context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) {

@ -138,20 +138,19 @@
</div>
<div id="no-device-view" class="ast-container list-view hidden">
<div class="ctrl-info-panel col-centered text-center wr-login">
<h2>You don't have any device registered at the moment.</h2>
<br/>
<h2>You do not have any device enrolled at the moment.</h2>
<p class="text-center">
<a href="javascript:toggleEnrollment()" class="wr-btn">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-mobile fw-stack-1x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>
<i class="fw fw-circle fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i>
<i class="fw fw-add fw-stack-1x fw-inverse"></i>
</span>
</span>
Enroll New Device
&nbsp;&nbsp;Enroll New Device
</a>
</p>
</div>

@ -29,10 +29,10 @@ function onRequest() {
userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows");
// [2] checking advanced device search permissions
permissions["ADVANCED_SEARCH"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
permissions["ADVANCED_SEARCH"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
// [3] checking device viewing permission
permissions["VIEW_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
permissions["VIEW_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
var currentUser = session.get(constants["USER_SESSION_KEY"]);

@ -76,8 +76,10 @@ function loadDevices() {
return {};
}
var fnCreatedRow = function (nRow) {
var fnCreatedRow = function (nRow, aData, dataIndex) {
$(nRow).attr('data-type', 'selectable');
$(nRow).attr('data-deviceid', aData.deviceIdentifier);
$(nRow).attr('data-devicetype', aData.deviceType);
};
@ -226,7 +228,7 @@ function initPage() {
function (data) {
if (data) {
data = JSON.parse(data);
if (data.devices.length > 0) {
if (data["count"] > 0) {
$(".bulk-action-row").removeClass('hidden');
loadDevices();
} else {

@ -273,7 +273,7 @@
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-yes-link" class="btn-operations">Remove</a>
<a href="#" id="remove-policy-cancel-link" class="btn-operations">Cancel</a>
<a href="#" id="remove-policy-cancel-link" class="btn-operations btn-default">Cancel</a>
</div>
</div>
</div>
@ -342,7 +342,7 @@
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-yes-link" class="btn-operations">Yes</a>
<a href="#" id="publish-policy-cancel-link" class="btn-operations">No</a>
<a href="#" id="publish-policy-cancel-link" class="btn-operations btn-default">No</a>
</div>
</div>
</div>
@ -398,7 +398,7 @@
Yes
</a>
<a href="#" id="unpublish-policy-cancel-link" class="btn-operations">
<a href="#" id="unpublish-policy-cancel-link" class="btn-operations btn-default">
No
</a>
</div>
@ -492,7 +492,7 @@
Yes
</a>
<a href="#" id="change-policy-cancel-link" class="btn-operations">
<a href="#" id="change-policy-cancel-link" class="btn-operations btn-default">
No
</a>
</div>

@ -0,0 +1,25 @@
{{!
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
}}
{{#zone "topCss"}}
{{css "css/daterangepicker.css"}}
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}
{{js "js/daterangepicker.js"}}
{{/zone}}

@ -0,0 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function onRequest() {
return "";
}

@ -0,0 +1,361 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
.date-picker {
width: 170px;
height: 25px;
padding: 0;
border: 0;
line-height: 25px;
padding-left: 10px;
font-size: 12px;
font-family: Arial;
font-weight: bold;
cursor: pointer;
color: #303030;
position: relative;
z-index: 2;
}
.date-picker-wrapper {
position: absolute;
z-index: 1;
border: 1px solid #bfbfbf;
background-color: #efefef;
width: 448px;
padding: 5px 12px;
font-size: 12px;
line-height: 20px;
color: #aaa;
font-family: Arial;
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
}
.date-picker-wrapper.single-date {
width: auto;
}
.date-picker-wrapper.no-shortcuts {
padding-bottom: 12px;
}
.date-picker-wrapper .footer {
display: none;
font-size: 11px;
padding-top: 3px;
}
.date-picker-wrapper b {
color: #666;
font-weight: 700;
}
.date-picker-wrapper a {
color: rgb(107, 180, 214);
text-decoration: underline;
}
.date-picker-wrapper .month-wrapper {
border: 1px solid #bfbfbf;
border-radius: 3px;
background-color: #fff;
padding: 5px;
cursor: default;
position: relative;
_overflow: hidden;
}
.date-picker-wrapper .month-wrapper table {
width: 190px;
float: left;
}
.date-picker-wrapper .month-wrapper table.month2 {
width: 190px;
float: right;
}
.date-picker-wrapper .month-wrapper table th,
.date-picker-wrapper .month-wrapper table td {
vertical-align: middle;
text-align: center;
line-height: 14px;
margin: 0px;
padding: 0px;
}
.date-picker-wrapper .month-wrapper table .day {
height: 19px;
line-height: 19px;
font-size: 12px;
margin-bottom: 1px;
color: #999;
cursor: default;
}
.date-picker-wrapper .month-wrapper table div.day.lastMonth,
.date-picker-wrapper .month-wrapper table div.day.nextMonth {
color: #999;
cursor: default;
}
.date-picker-wrapper .month-wrapper table .day.checked {
background-color: rgb(156, 219, 247);
}
.date-picker-wrapper .month-wrapper table .week-name {
height: 20px;
line-height: 20px;
font-weight: 100;
}
.date-picker-wrapper .month-wrapper table .day.has-tooltip {
cursor: help !important;
}
.date-picker-wrapper .month-wrapper table .day.toMonth.valid {
color: #333;
cursor: pointer;
}
.date-picker-wrapper .month-wrapper table .day.real-today {
background-color: rgb(255, 230, 132);
}
.date-picker-wrapper .month-wrapper table .day.real-today.checked {
background-color: rgb(112, 204, 213);
}
.date-picker-wrapper table .caption {
height: 40px;
}
.date-picker-wrapper table .caption .next,
.date-picker-wrapper table .caption .prev {
padding: 0 5px;
cursor: pointer;
}
.date-picker-wrapper table .caption .next:hover,
.date-picker-wrapper table .caption .prev:hover {
background-color: #ccc;
color: white;
}
.date-picker-wrapper .gap {
position: absolute;
display: none;
top: 0px;
left: 204px;
z-index: 1;
width: 15px;
height: 100%;
background-color: red;
font-size: 0;
line-height: 0;
}
.date-picker-wrapper .gap .gap-lines {
height: 100%;
overflow: hidden;
}
.date-picker-wrapper .gap .gap-line {
height: 15px;
width: 15px;
position: relative;
}
.date-picker-wrapper .gap .gap-line .gap-1 {
z-index: 1;
height: 0;
border-left: 8px solid white;
border-top: 8px solid #eee;
border-bottom: 8px solid #eee;
}
.date-picker-wrapper .gap .gap-line .gap-2 {
position: absolute;
right: 0;
top: 0px;
z-index: 2;
height: 0;
border-left: 8px solid transparent;
border-top: 8px solid white;
}
.date-picker-wrapper .gap .gap-line .gap-3 {
position: absolute;
right: 0;
top: 8px;
z-index: 2;
height: 0;
border-left: 8px solid transparent;
border-bottom: 8px solid white;
}
.date-picker-wrapper .gap .gap-top-mask {
width: 6px;
height: 1px;
position: absolute;
top: -1px;
left: 1px;
background-color: #eee;
z-index: 3;
}
.date-picker-wrapper .gap .gap-bottom-mask {
width: 6px;
height: 1px;
position: absolute;
bottom: -1px;
left: 7px;
background-color: #eee;
z-index: 3;
}
.date-picker-wrapper .selected-days {
display: none;
}
.date-picker-wrapper .drp_top-bar {
line-height: 40px;
height: 40px;
position: relative;
}
.date-picker-wrapper .drp_top-bar .error-top {
display: none;
}
.date-picker-wrapper .drp_top-bar .normal-top {
display: none;
}
.date-picker-wrapper .drp_top-bar .default-top {
display: block;
}
.date-picker-wrapper .drp_top-bar.error .default-top {
display: none;
}
.date-picker-wrapper .drp_top-bar.error .error-top {
display: block;
color: red;
}
.date-picker-wrapper .drp_top-bar.normal .default-top {
display: none;
}
.date-picker-wrapper .drp_top-bar.normal .normal-top {
display: block;
}
.date-picker-wrapper .drp_top-bar .apply-btn {
position: absolute;
right: 0px;
top: 6px;
padding: 3px 5px;
margin: 0;
font-size: 12px;
border-radius: 4px;
cursor: pointer;
color: #d9eef7;
border: solid 1px #0076a3;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
color: white;
}
.date-picker-wrapper .drp_top-bar .apply-btn.disabled {
pointer-events: none;
color: #606060;
border: solid 1px #b7b7b7;
background: #fff;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
background: -moz-linear-gradient(top, #fff, #ededed);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
}
/*time styling*/
.time {
position: relative;
}
.time input[type=range] {
vertical-align: middle;
}
.time1, .time2 {
width: 180px;
padding: 0 5px;
text-align: center;
}
.time1 {
float: left;
}
.time2 {
float: right;
}
.hour, .minute {
text-align: left;
}
.hide {
display: none;
}
input.hour-range, input.minute-range {
width: 150px;
}
#dateRangePickerContainer .date-range, #dateRangePickerContainer .input-append {
background: none !important;
}
#date-range {
padding-right: 30px;
width: 300px;
height: 100%;
display: inline-block;
}
#dateRangePickerContainer {
float: right;
}
.date-range {
border: 1px solid #ccc;
}
#dateRangePickerContainer button.active {
background-color: #e6e6e6 !important;
}
#dateRangePickerContainer .btn-default:hover {
background-color: #b2b2b2;
border-color: #000000;
}

@ -16,6 +16,8 @@
under the License.
}}
{{unit "mdm.unit.date-range-picker"}}
{{#zone "content"}}
<div id = "operations-mod" data-permissions="{{permissions}}">
{{unit "mdm.unit.device.operation-mod"}}

@ -16,7 +16,7 @@
* under the License.
*/
function onRequest(context) {
function onRequest() {
// var log = new Log("mdm.unit.device.operation-bar");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var viewModel = {};
@ -24,48 +24,79 @@ function onRequest(context) {
// adding android operations related permission checks
permissions["android"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/ring")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/ring")) {
permissions["android"].push("DEVICE_RING");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/lock-devices")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/lock")) {
permissions["android"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/unlock-devices")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/unlock")) {
permissions["android"].push("DEVICE_UNLOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/location")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/location")) {
permissions["android"].push("DEVICE_LOCATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/clear-password")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/clear-password")) {
permissions["android"].push("CLEAR_PASSWORD");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/reboot")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/reboot")) {
permissions["android"].push("DEVICE_REBOOT");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/upgrade-firmware")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/upgrade-firmware")) {
permissions["android"].push("UPGRADE_FIRMWARE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/mute")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/mute")) {
permissions["android"].push("DEVICE_MUTE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/send-notification")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/send-notification")) {
permissions["android"].push("NOTIFICATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/change-lock-code")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/change-lock-code")) {
permissions["android"].push("CHANGE_LOCK_CODE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/enterprise-wipe")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/enterprise-wipe")) {
permissions["android"].push("ENTERPRISE_WIPE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/wipe")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/wipe")) {
permissions["android"].push("WIPE_DATA");
}
// adding ios operations related permission checks
permissions["ios"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/lock")) {
permissions["ios"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/location")) {
permissions["ios"].push("LOCATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/enterprise-wipe")) {
permissions["ios"].push("ENTERPRISE_WIPE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/notification")) {
permissions["ios"].push("NOTIFICATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/ring")) {
permissions["ios"].push("RING");
}
// adding windows operations related permission checks
permissions["windows"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock")) {
permissions["windows"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/disenroll/windows")) {
permissions["windows"].push("DISENROLL");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/wipe")) {
permissions["windows"].push("WIPE_DATA");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/ring")) {
permissions["windows"].push("DEVICE_RING");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lockreset")) {
permissions["windows"].push("LOCK_RESET");
}
viewModel["permissions"] = stringify(permissions);
return viewModel;
}

@ -235,7 +235,7 @@
<div class="modal-footer">
<div class="buttons">
<a href="javascript:runOperation('{{code}}')" class="btn-operations">Yes</a>
<a href="javascript:hidePopup()" class="btn-operations">No</a>
<a href="javascript:hidePopup()" class="btn-operations btn-default">No</a>
</div>
</div>
</div>

@ -107,7 +107,6 @@ var operationModule = function () {
"NOTIFICATION_OPERATION_CODE": "NOTIFICATION",
"CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION",
"APN_OPERATION_CODE": "APN",
"DOMAIN_CODE": "DOMAIN",
"CELLULAR_OPERATION_CODE": "CELLULAR",
"PER_APP_VPN_OPERATION_CODE": "PER_APP_VPN",
"APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE": "APP_TO_PER_APP_VPN_MAPPING"
@ -116,20 +115,10 @@ var operationModule = function () {
publicMethods.getIOSServiceEndpoint = function (operationCode) {
var featureMap = {
"DEVICE_LOCK": "lock",
"VPN": "vpn",
"PER_APP_VPN": "per-app-vpn",
"APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping",
"RING": "ring",
"LOCATION": "location",
"ENTERPRISE_WIPE": "enterprise-wipe",
"NOTIFICATION": "notification",
"AIR_PLAY": "airplay",
"RESTRICTION": "restriction",
"CELLULAR": "cellular",
"WIFI": "wifi",
"INSTALL_STORE_APPLICATION": "store-application",
"INSTALL_ENTERPRISE_APPLICATION": "enterprise-application",
"REMOVE_APPLICATION": "remove-application",
"ENTERPRISE_WIPE": "enterprise-wipe"
"RING": "ring"
};
return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode];
};
@ -851,6 +840,24 @@ var operationModule = function () {
"restrictedApplications": operationPayload["restricted-applications"]
};
break;
case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]:
if (operationPayload["type"] != "window") {
payload = {
"cosuSystemUpdatePolicyType": operationPayload["type"]
};
} else {
payload = {
"cosuSystemUpdatePolicyType": operationPayload["type"],
"cosuSystemUpdatePolicyWindowStartTime": operationPayload["startTime"],
"cosuSystemUpdatePolicyWindowEndTime": operationPayload["endTime"]
};
}
break;
case androidOperationConstants["KIOSK_APPS_CODE"]:
payload = {
"cosuWhitelistedApplications": operationPayload["whitelistedApplications"]
};
break;
}
return payload;
};
@ -895,7 +902,7 @@ var operationModule = function () {
"ALLOW_PARENT_PROFILE_APP_LINKING" : operationData["disallowParentProfileAppLinking"],
"ENSURE_VERIFY_APPS" : operationData["ensureVerifyApps"],
"AUTO_TIME" : operationData["enableAutoTime"],
"SET_SCREEN_CAPTURE_DISABLED" : operationData["diableScreenCapture"],
"SET_SCREEN_CAPTURE_DISABLED" : operationData["disableScreenCapture"],
"SET_STATUS_BAR_DISABLED" : operationData["disableStatusBar"]
}
};
@ -1016,13 +1023,21 @@ var operationModule = function () {
break;
case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]:
operationType = operationTypeConstants["PROFILE"];
payload = {
"operation": {
"type": operationData["cosuSystemUpdateType"],
"startTime": operationData["cosuWindowStartTime"],
"endTime": operationData["cosuWindowEndTime"]
}
};
if (operationData["cosuSystemUpdatePolicyType"] != "window") {
payload = {
"operation": {
"type": operationData["cosuSystemUpdatePolicyType"]
}
};
} else {
payload = {
"operation": {
"type": operationData["cosuSystemUpdatePolicyType"],
"startTime": operationData["cosuSystemUpdatePolicyWindowStartTime"],
"endTime": operationData["cosuSystemUpdatePolicyWindowEndTime"]
}
};
}
break;
case androidOperationConstants["KIOSK_APPS_CODE"]:
operationType = operationTypeConstants["PROFILE"];
@ -1178,29 +1193,14 @@ var operationModule = function () {
publicMethods.getWindowsServiceEndpoint = function (operationCode) {
var featureMap = {
"CAMERA": "camera",
"DEVICE_LOCK": "lock",
"DEVICE_LOCATION": "location",
"CLEAR_PASSWORD": "clear-password",
"APPLICATION_LIST": "get-application-list",
"DEVICE_RING": "ring-device",
"DEVICE_REBOOT": "reboot-device",
"UPGRADE_FIRMWARE": "upgrade-firmware",
"DEVICE_MUTE": "mute",
"LOCK_RESET": "lock-reset",
"NOTIFICATION": "notification",
"ENCRYPT_STORAGE": "encrypt",
"CHANGE_LOCK_CODE": "change-lock-code",
"WEBCLIP": "webclip",
"INSTALL_APPLICATION": "install-application",
"UNINSTALL_APPLICATION": "uninstall-application",
"BLACKLIST_APPLICATIONS": "blacklist-applications",
"PASSCODE_POLICY": "password-policy",
"ENTERPRISE_WIPE": "enterprise-wipe",
"WIPE_DATA": "wipe-data",
"DISENROLL": "disenroll"
"DEVICE_LOCK": "lock-devices",
"DISENROLL": "disenroll",
"DEVICE_RING": "ring-devices",
"LOCK_RESET": "lock-reset-devices",
"WIPE_DATA": "wipe-devices"
};
return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode];
//return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode];
return "/api/device-mgt/windows/v1.0/services/windows/admin/devices/" + featureMap[operationCode];
};
/**
* Get the icon for the featureCode
@ -1233,15 +1233,10 @@ var operationModule = function () {
publicMethods.getWindowsIconForFeature = function (operationCode) {
var featureMap = {
"DEVICE_LOCK": "fw-lock",
"DEVICE_LOCATION": "fw-map-location",
"DISENROLL": "fw-delete",
"WIPE_DATA": "fw-clear",
"DEVICE_RING": "fw-dial-up",
"DEVICE_REBOOT": "fw-refresh",
"UPGRADE_FIRMWARE": "fw-up-arrow",
"DEVICE_MUTE": "fw-incoming-call",
"NOTIFICATION": "fw-message",
"LOCK_RESET": "fw-key"
"DISENROLL": "fw-delete",
"LOCK_RESET": "fw-key",
"WIPE_DATA": "fw-clear"
};
return featureMap[operationCode];
};
@ -1292,14 +1287,18 @@ var operationModule = function () {
var key = operationDataObj.data("key");
var value;
if (operationDataObj.is(":text") || operationDataObj.is("textarea") ||
operationDataObj.is(":password") || operationDataObj.is(":hidden")) {
operationDataObj.is(":password") || operationDataObj.is("input[type=hidden]")) {
value = operationDataObj.val();
operationData[key] = value;
} else if (operationDataObj.is(":checkbox")) {
value = operationDataObj.is(":checked");
operationData[key] = value;
} else if (operationDataObj.is(":radio") && operationDataObj.is(":checked")) {
value = operationDataObj.val();
value = operationDataObj.val();
operationData[key] = value;
} else if (operationDataObj.is("select")) {
value = operationDataObj.find("option:selected").attr("value");
operationData[key] = value;
} else if (operationDataObj.hasClass("grouped-array-input")) {
value = [];
var childInput;
@ -1308,7 +1307,7 @@ var operationModule = function () {
$(".child-input", this).each(function () {
childInput = $(this);
if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
|| childInput.is(":hidden")) {
|| childInput.is("input[type=hidden]")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@ -1335,7 +1334,7 @@ var operationModule = function () {
$(".child-input", this).each(function () {
childInput = $(this);
if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
|| childInput.is(":hidden")) {
|| childInput.is("input[type=hidden]")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@ -1367,7 +1366,7 @@ var operationModule = function () {
childInput = $(this);
childInputKey = childInput.data("child-key");
if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")
|| childInput.is(":hidden")) {
|| childInput.is("input[type=hidden]")) {
childInputValue = childInput.val();
} else if (childInput.is(":checkbox")) {
childInputValue = childInput.is(":checked");
@ -1391,8 +1390,8 @@ var operationModule = function () {
}
});
}
operationData[key] = value;
}
operationData[key] = value;
}
);
@ -1443,10 +1442,15 @@ var operationModule = function () {
// populating input value according to the type of input
if (operationDataObj.is(":text") ||
operationDataObj.is("textarea") ||
operationDataObj.is(":password")) {
operationDataObj.is(":password") ||
operationDataObj.is("input[type=hidden]")) {
operationDataObj.val(value);
} else if (operationDataObj.is(":checkbox")) {
operationDataObj.prop("checked", value);
} else if (operationDataObj.is(":radio")) {
if (operationDataObj.val() == uiPayload[key]) {
operationDataObj.attr("checked", true);
}
} else if (operationDataObj.is("select")) {
operationDataObj.val(value);
/* trigger a change of value, so that if slidable panes exist,
@ -1469,9 +1473,9 @@ var operationModule = function () {
var childInputValue = value[childInputIndex];
// populating extracted value in the UI according to the input type
if (childInput.is(":text") ||
childInput.is(":hidden") ||
childInput.is("textarea") ||
childInput.is(":password") ||
childInput.is("input[type=hidden]") ||
childInput.is("select")) {
childInput.val(childInputValue);
} else if (childInput.is(":checkbox")) {
@ -1517,9 +1521,9 @@ var operationModule = function () {
}
// populating extracted value in the UI according to the input type
if (childInput.is(":text") ||
childInput.is(":hidden") ||
childInput.is("textarea") ||
childInput.is(":password") ||
childInput.is("input[type=hidden]") ||
childInput.is("select")) {
childInput.val(childInputValue);
} else if (childInput.is(":checkbox")) {
@ -1546,9 +1550,9 @@ var operationModule = function () {
var childInputValue = multiColumnKeyValuePair[childInputKey];
// populating extracted value in the UI according to the input type
if (childInput.is(":text") ||
childInput.is(":hidden") ||
childInput.is("textarea") ||
childInput.is(":password") ||
childInput.is("input[type=hidden]") ||
childInput.is("select")) {
childInput.val(childInputValue);
} else if (childInput.is(":checkbox")) {
@ -1582,7 +1586,7 @@ var operationModule = function () {
var payload = publicMethods.generatePayload(platformType, operationCode, null);
if(platformType == platformTypeConstants["ANDROID"] &&
operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]){
operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]){
var operations = payload["operation"];
for (var key in operations){
operationCode = key;
@ -1719,7 +1723,7 @@ var operationModule = function () {
restrictions["enableAutoTime"] = restriction["enabled"];
continue;
} else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]){
restrictions["diableScreenCapture"] = restriction["enabled"];
restrictions["disableScreenCapture"] = restriction["enabled"];
continue;
} else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]){
restrictions["disableStatusBar"] = restriction["enabled"];

@ -18,25 +18,46 @@
{{#zone "content"}}
<div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden">
<div class="modal-header">
<h3 class="pull-left modal-title">
Scan QR code to start enrollment
</h3>
<h4 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-mobile fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i>
<i class="fw fw-add fw-stack-1x fw-inverse"></i>
</span>
</span>
&nbsp;&nbsp;Add your new mobile device to {{@app.conf.appName}}
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<hr>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div>
<h4>
Please scan the QR code using your mobile device to retrieve enrollment URL.
</h4>
<div class="panel-body col-centered text-center">
<h5>
Please scan the following QR code using your new <b>Android</b>, <b>iPhone</b> or <b>Windows</b> mobile device.
</h5>
<br>
<div class="panel panel-default">
<div class="panel-body col-centered text-center">
<div class="panel-body">
<div class="qr-code"></div>
</div>
</div>
<br>
<h5>
Not having a QR code scanner in your device?
<br><br>
Try following link
<br><br>
<b>{{enrollmentURL}}</b>
<br><br>
on your device's Internet browser instead.
</h5>
</div>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations btn-default">Ok</a>
</div>
</div>
</div>

@ -14,11 +14,10 @@
* limitations under the License.
*/
function onRequest(context) {
function onRequest() {
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var viewModel = {};
//TODO: Move enrollment URL into app-conf.json
viewModel.enrollmentURL = mdmProps.generalConfig.host + mdmProps.enrollmentDir;
viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
return viewModel;
}

@ -44,7 +44,7 @@ var InitiateViewOption = null;
// error-callback
function () {
var defaultInnerHTML =
"<br><p class='fw-warning'>Device data may not have been updated. Please refresh to try again.<p>";
"<br><p class='small'><i class='fw-warning'></i>&nbsp;Device data may not have been updated. Please refresh to try again.<p>";
$(".panel-body").append(defaultInnerHTML);
}
);

@ -219,7 +219,7 @@
<div class="panel-heading display-none-xs">
Policy Compliance
<span>
<a href="#" id="refresh-policy">
<a href="javascript:void(0);" id="refresh-policy">
<i class="fw fw-refresh"></i>
</a>
</span>
@ -227,7 +227,7 @@
<div id="collapseTwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="policy_compliance">
<div class="panel-body ">
<span class="visible-xs add-padding-2x text-right">
<a href="#" id="refresh-policy">
<a href="javascript:void(0);" id="refresh-policy">
<i class="fw fw-refresh"></i>
</a>
</span>
@ -278,7 +278,7 @@
<div class="panel-heading display-none-xs">
Installed Applications
<span>
<a href="#" id="refresh-apps">
<a href="javascript:void(0);" id="refresh-apps">
<i class="fw fw-refresh"></i>
</a>
</span>
@ -286,7 +286,7 @@
<div id="collapseFour" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="installed_applications">
<div class="panel-body ">
<span class="visible-xs add-padding-2x text-right">
<a href="#" id="refresh-apps">
<a href="javascript:void(0);" id="refresh-apps">
<i class="fw fw-refresh"></i>
</a>
</span>
@ -315,7 +315,7 @@
<div class="panel-heading display-none-xs">
Operations Logs
<span>
<a href="#" id="refresh-operations">
<a href="javascript:void(0);" id="refresh-operations">
<i class="fw fw-refresh"></i>
</a>
</span>
@ -323,7 +323,7 @@
<div id="collapseFive" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="event_log">
<div class="panel-body">
<span class="visible-xs add-padding-2x text-right">
<a href="#" id="refresh-operations">
<a href="javascript:void(0);" id="refresh-operations">
<i class="fw fw-refresh"></i>
</a>
</span>

@ -86,6 +86,7 @@
</div>
<br class="c-both"/>
</div>
<br class="c-both"/>
<label class="wr-input-label">
Add a description
</label>
@ -176,7 +177,7 @@
</div>
</div>
{{/if}}
{{#if isAuthorizedVieUsers}}
{{#if isAuthorizedViewUsers}}
<div id="users-select-field" class="select-users">
<div class="wr-input-control">
<div class="cus-col-50">

@ -60,8 +60,8 @@ function onRequest() {
viewModelData["roles"] = result["content"];
}
viewModelData.isAuthorized = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage");
viewModelData.isAuthorizedViewUsers = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
viewModelData.isAuthorizedViewRoles = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
viewModelData.isAuthorizedViewUsers = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
viewModelData.isAuthorizedViewRoles = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
return viewModelData;
}

@ -57,28 +57,35 @@
<span id="work-profile-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="work-profile-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<!--COSU-->
<a href="javascript:void(0)" onclick="showAdvanceOperation('android-for-work-cosu', this)">
<span class="wr-hidden-operation-icon fw-stack">
<i class="fw fw-service fw-stack-2x"></i>
</span>
&nbsp;&nbsp;COSU Configuration
<span id="android-for-work-cosu-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="android-for-work-cosu-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="android-for-work-cosu-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<!--/COSU-->
<a href="javascript:void(0)" onclick="showAdvanceOperation('app-restriction', this)">
<span class="fw-stack fw-lg">
<i class="fw fw-application fw-stack-1x"></i>
<i class="fw fw-block fw-stack-2x"></i>
</span>
<span class="fw-stack fw-lg">
<i class="fw fw-application fw-stack-1x"></i>
<i class="fw fw-block fw-stack-2x"></i>
</span>
Applications Restrictions
<span id="app-restriction-configured" class="has-configured status-icon hidden"><i
class="fw fw-ok"></i></span>
<span id="app-restriction-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="app-restriction-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cosu-system-update-policy', this)">
<span class="wr-hidden-operation-icon fw-stack">
<i class="fw fw-import fw-stack-2x"></i>
</span>
&nbsp;&nbsp;System Update Policy (COSU)
<span id="cosu-system-update-policy-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-system-update-policy-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-system-update-policy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cosu-whitelist-applications', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-register fw-stack-2x"></i>
</span>
Whitelist Apps (COSU)
<span id="cosu-whitelist-applications-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-whitelist-applications-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-whitelist-applications-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
@ -448,7 +455,7 @@
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input id="disable-screen-capture-enabled" type="checkbox" class="operationDataKeys"
data-key="diableScreenCapture"/>
data-key="disableScreenCapture"/>
<span class="helper" title="Having this checked would disable screen capture .">
&nbsp;&nbsp;&nbsp;Disable screen capture
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
@ -865,7 +872,7 @@
</span>
</label>
<input id="wifi-cacert-upload" type="file" class="form-control"
onchange="base64EncodeFile(this, document.getElementById('wifi-cacert'), document.getElementById('wifi-cacert-name'))"/>
onchange="base64EncodeFile(this, document.getElementById('wifi-cacert'), document.getElementById('wifi-cacert-name'))"/>
<input id="wifi-cacert" type="hidden" class="form-control operationDataKeys"
data-key="wifiCaCert" />
<input id="wifi-cacert-name" type="hidden" class="form-control operationDataKeys"
@ -886,6 +893,7 @@
</div>
</div>
<!-- /wi-fi -->
<!--app-restriction-->
<div class="wr-hidden-operation" data-operation="app-restriction">
<div class="panel panel-default operation-data" data-operation="app-restriction"
@ -1068,113 +1076,6 @@
</div>
<!-- /VPN -->
<!-- install-applications -->
<!--<div class="wr-hidden-operation" data-operation="install-apps">-->
<!--<div class="panel panel-default operation-data" data-operation="INSTALL_APPLICATION">-->
<!--<div class="panel-heading" role="tab">-->
<!--<h2 class="sub-title panel-title">-->
<!--<br>-->
<!--&nbsp;&nbsp;&nbsp;App Installations-->
<!--<label class="wr-input-control switch" data-toggle="collapse" data-target="#installApp">-->
<!--<input type="checkbox" />-->
<!--<span class="helper"></span>-->
<!--<span class="text"></span>-->
<!--</label>-->
<!--<br>-->
<!--<br>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="installApp" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installApp">-->
<!--<div id="install-app-feature-error-msg" class="alert alert-danger hidden" role="alert">-->
<!--<i class="icon fw fw-error"></i><span></span>-->
<!--</div>-->
<!--<label class="wr-input-label" title="Application Identifier">App Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>-->
<!--<div class="wr-input-control">-->
<!--<input type="text" class="form-control operationDataKeys" id="package-name" data-key="packageName" placeholder="Enter App Identifier"/>-->
<!--</div>-->
<!--<div class="wr-input-control">-->
<!--<label class="wr-input-control dropdown">-->
<!--<span class="helper" title="App Type">App Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>-->
<!--<select class="form-control col-sm-8 operationDataKeys appTypesInput" id="type" data-key="type">-->
<!--<option>Public</option>-->
<!--<option>Enterprise</option>-->
<!--</select>-->
<!--</label>-->
<!--</div>-->
<!--<label class="wr-input-label" title="URL">URL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>-->
<!--<div class="wr-input-control">-->
<!--<input type="text" class="form-control operationDataKeys" id="url" data-key="url" placeholder="Enter URL"/>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /install-applications -->
<!-- /uninstall-applications -->
<!--<div class="wr-hidden-operation" data-operation="uninstall-apps">-->
<!--<div class="panel panel-default operation-data" data-operation="UNINSTALL_APPLICATION">-->
<!--<div class="panel-heading" role="tab">-->
<!--<h2 class="sub-title panel-title">-->
<!--<br>-->
<!--&nbsp;&nbsp;&nbsp;App Uninstallations-->
<!--<label class="wr-input-control switch" data-toggle="collapse" data-target="#uninstallApp">-->
<!--<input type="checkbox" />-->
<!--<span class="helper"></span>-->
<!--<span class="text"></span>-->
<!--</label>-->
<!--<br>-->
<!--<br>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="uninstallApp" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="uninstallApp">-->
<!--<div id="uninstall-app-feature-error-msg" class="alert alert-danger hidden" role="alert">-->
<!--<i class="icon fw fw-error"></i><span></span>-->
<!--</div>-->
<!--<label class="wr-input-label" title="Application Identifier">App Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>-->
<!--<!--span>Identification of the wireless network to connect to</span-->
<!--<div class="wr-input-control">-->
<!--<input type="text" class="form-control operationDataKeys" id="package-name" data-key="packageName" placeholder="Enter App Identifier"/>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /uninstall-applications -->
<!-- /web-clips -->
<!--<div class="wr-hidden-operation" data-operation="web-clips">-->
<!--<div class="panel panel-default operation-data" data-operation="WEBCLIP">-->
<!--<div class="panel-heading" role="tab">-->
<!--<h2 class="sub-title panel-title">-->
<!--<br>-->
<!--&nbsp;&nbsp;&nbsp;Web clips-->
<!--<label class="wr-input-control switch" data-toggle="collapse" data-target="#installWebClip">-->
<!--<input type="checkbox" />-->
<!--<span class="helper"></span>-->
<!--<span class="text"></span>-->
<!--</label>-->
<!--<br>-->
<!--<br>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="installWebClip" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installWebClip">-->
<!--<div id="install-webclip-feature-error-msg" class="alert alert-danger hidden" role="alert">-->
<!--<i class="icon fw fw-error"></i><span></span>-->
<!--</div>-->
<!--<label class="wr-input-label" title="Title of the web clip">Title<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>-->
<!--<div class="wr-input-control">-->
<!--<input type="text" class="form-control operationDataKeys" id="title" data-key="title" placeholder="Enter Title"/>-->
<!--</div>-->
<!--<label class="wr-input-label" title="URL">URL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>-->
<!--<div class="wr-input-control">-->
<!--<input type="text" class="form-control operationDataKeys" id="url" data-key="url" placeholder="Enter URL"/>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /web-clips -->
<!--Work-profile-->
<div class="wr-hidden-operation" data-operation="work-profile">
<div class="panel panel-default operation-data" data-operation="work-profile"
@ -1262,7 +1163,7 @@
rows="4" data-key="workProfilePolicyUnhideSystemApps" placeholder=""></textarea>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="passcode-policy-max-passcode-age-in-days">
<label class="wr-input-label" for="work-profile-policy-install-playstore-apps">
Enable Google Play Store Apps
<span class="helper"
title="The set of apps needed to be installed from Google Playstore to work-profile">
@ -1279,88 +1180,91 @@
</div>
</div>
<!--android-for-work-cosu-->
<div class="wr-hidden-operation" data-operation="android-for-work-cosu">
<!--system-update-policy-->
<div class="panel panel-default operation-data" data-operation="system-update-policy"
data-operation-code="SYSTEM_UPDATE_POLICY">
<div id="system-update-policy-heading" class="panel-heading" role="tab">
<!-- cosu-system-update-policy -->
<div class="wr-hidden-operation" data-operation="cosu-system-update-policy">
<div class="panel panel-default operation-data" data-operation="cosu-system-update-policy"
data-operation-code="SYSTEM_UPDATE_POLICY">
<div id="cosu-system-update-policy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
System Update Policy
<label id="system-update-policy-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#system-update-policy-body">
System Update Policy (COSU)
<label id="cosu-system-update-policy-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-system-update-policy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Android Device.
Once this configuration profile is installed on a device, corresponding users will not be
able
to modify these settings on their devices.
</div>
</h2>
</div>
<div id="system-update-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="android-for-work-cosu-policy-body">
<div id="system-update-policy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<div id="cosu-system-update-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="cosu-system-update-policy-body">
<div id="cosu-system-update-policy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="android-for-work-cosu-policy-system-update">
<label class="wr-input-label">
System Update
<span class="helper" title="Type of the System Update to be set by the Device Owner">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
</label>
<br>
<div class="wr-input-control">
<label class="wr-input-control radio light">
<input id="automatic-system-update-radio-btn" type="radio" name="android-for-work-cosu-policy-system-update"
class="form-control operationDataKeys" data-key="cosuSystemUpdateType"
value="automatic" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'android-for-work-cosu-window-select', ['window'])" checked/>
<span class="helper" title="Installs system update automatically as soon as one is available">
&nbsp;Automatic
</span>
</span>
</label>
<label class="wr-input-control radio light">
<input id="postpone-system-update-radio-btn" type="radio" name="android-for-work-cosu-policy-system-update"
class="form-control operationDataKeys" data-key="cosuSystemUpdateType"
value="postpone" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'android-for-work-cosu-window-select', ['window'])"/>
<span class="helper" title="Incoming system update will be blocked for a maximum of 30 days">
&nbsp;Postpone
</span>
</label>
<label class="wr-input-control radio light">
<input id="window-system-update-radio-btn" type="radio" name="android-for-work-cosu-policy-system-update"
class="form-control operationDataKeys" data-key="cosuSystemUpdateType"
value="window" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'android-for-work-cosu-window-select', ['window'])"/>
<span class="helper" title="Install system update automatically within a daily maintenance window, for a maximum of 30 days">
&nbsp;Window
</span>
</label>
</div>
<br><br>
<label class="wr-input-control radio light">
<input id="automatic-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="automatic" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])" checked/>
<span class="helper" title="Installs system update automatically as soon as one is available">
&nbsp;Automatic
</span>
</label>
<label class="wr-input-control radio light">
<input id="postpone-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="postpone" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])"/>
<span class="helper" title="Incoming system update will be blocked for a maximum of 30 days">
&nbsp;Postpone
</span>
</label>
<label class="wr-input-control radio light">
<input id="window-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="window" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])"/>
<span class="helper" title="Install system update automatically within a daily maintenance window, for a maximum of 30 days">
&nbsp;Window
</span>
</label>
</div>
<div id="android-for-work-cosu-window-select" class="hidden">
<div id="cosu-system-update-policy-window-select" class="hidden">
<div>
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="android-for-work-cosu-window-select-msg"> Below configuration of start time and end time are valid only when
<b>window</b> option is selected.</a>
<a id="cosu-system-update-policy-window-select-msg">
Below configuration of start time and end time are valid only when
<b>window</b> option is selected.
</a>
</ul>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="android-for-work-cosu-window-start-time">
<label class="wr-input-label" for="cosu-system-update-policy-window-start-time">
Start Time
<span class="helper" title="Window start time for system update">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="android-for-work-cosu-start-time" class="form-control operationDataKeys"
data-key="cosuWindowStartTime" data-default="0">
<option value="1440" selected="selected">
12 AM
</option>
<select id="cosu-system-update-policy-window-start-time"
class="form-control operationDataKeys"
data-key="cosuSystemUpdatePolicyWindowStartTime" data-default="0">
<option value="1440" selected="selected">12 AM</option>
<option value="60">1 AM</option>
<option value="120">2 AM</option>
<option value="180">3 AM</option>
@ -1387,17 +1291,16 @@
</select>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="android-for-work-cosu-window-end-time">
Start Time
<label class="wr-input-label" for="cosu-system-update-policy-window-end-time">
End Time
<span class="helper" title="Window end time for system update">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="android-for-work-cosu-end-time" class="form-control operationDataKeys"
data-key="cosuWindowEndTime" data-default="0">
<option value="1440" selected="selected">
12 AM
</option>
<select id="cosu-system-update-policy-window-end-time"
class="form-control operationDataKeys"
data-key="cosuSystemUpdatePolicyWindowEndTime" data-default="0">
<option value="1440" selected="selected">12 AM</option>
<option value="60">1 AM</option>
<option value="120">2 AM</option>
<option value="180">3 AM</option>
@ -1409,7 +1312,7 @@
<option value="540">9 AM</option>
<option value="600">10 AM</option>
<option value="660">11 AM</option>
<option value="720">12 noon</option>
<option value="720">12 Noon</option>
<option value="780">1 PM</option>
<option value="840">2 PM</option>
<option value="900">3 PM</option>
@ -1424,39 +1327,49 @@
</select>
</div>
</div>
</div>
</div>
<!--system-update-policy-->
</div>
<!--whitelisted-applications-->
<div class="panel panel-default operation-data" data-operation="whitelisted-applications"
data-operation-code="KIOSK_APPS">
<div id="whitelisted-applications-heading" class="panel-heading" role="tab">
<!-- cosu-whitelist-applications -->
<div class="wr-hidden-operation" data-operation="cosu-whitelist-applications">
<div class="panel panel-default operation-data" data-operation="cosu-whitelist-applications"
data-operation-code="KIOSK_APPS">
<div id="cosu-whitelist-applications-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Whitelisted Applications
<label id="whitelisted-applications-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#whitelisted-applications-body">
Whitelist Applications (COSU)
<label id="cosu-whitelist-applications-lbl" class="wr-input-control switch" data-toggle="collapse"
data-target="#cosu-whitelist-applications-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Android Device.
Once this configuration profile is installed on a device, corresponding users will not be
able
to modify these settings on their devices.
</div>
</h2>
</div>
<div id="whitelisted-applications-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="whitelisted-applications-body">
<div id="whitelisted-applications-error-msg" class="alert alert-danger hidden" role="alert">
<div id="cosu-whitelist-applications-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="cosu-whitelist-applications-body">
<div id="cosu-whitelist-applications-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="whitelisted-application">
<br><br>Whitelisted Application List to enter Lock Task Mode
<span class="helper" title="Add an application to whitelist.">
<label class="wr-input-label" for="cosu-whitelisted-applications">
Whitelisted Applications to enter Lock Task Mode
<span class="helper" title="Configuration information specific to a given third-party VPN solution. This has to be input as key/value pairs.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
<a href="#whitelisted-applications-grid" class="grid-input-add" data-click-event="add-form">
<a href="#cosu-whitelisted-applications-grid" class="grid-input-add" data-click-event="add-form">
<span class="icon fw-stack">
<i class="fw fw-add fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i>
@ -1465,44 +1378,43 @@
Add Application
</a>
</label>
<div id="whitelisted-applications"
class="operationDataKeys grouped-array-input multi-column-key-value-pair-array"
data-key="cosuWhitelistedApplications" data-column-count="2">
<div id="cosu-whitelisted-applications"
class="operationDataKeys grouped-array-input multi-column-key-value-pair-array"
data-key="cosuWhitelistedApplications" data-column-count="2">
<table class="table table-responsive table-striped">
<thead>
<tr>
<th>No:</th>
<th>Application Name/Description</th>
<th>Package Name</th>
<th></th>
</tr>
<tr>
<th>No:</th>
<th>Application Name / Description</th>
<th>Package Name</th>
<th></th>
</tr>
</thead>
<tbody data-add-form-container="#whitelisted-applications-grid">
<tr data-help-text="add-form">
<td colspan="4">
No entries added yet.
</td>
</tr>
<tbody data-add-form-container="#cosu-whitelisted-applications-grid">
<tr data-help-text="add-form">
<td colspan="4">
No entries added yet .
</td>
</tr>
</tbody>
</table>
<table class="template hidden">
<tbody data-add-form="#whitelisted-applications-grid">
<tr data-add-form-element="clone">
<td data-title="No:">
<span class="index"></span>
</td>
<td data-title="App Name">
<input type="text" class="form-control grid-input-text" data-child-key="appName"
maxlength="100" data-default="" placeholder="[ Gmail ]"/>
</td>
<td data-title="Package Name">
<input type="text" class="form-control grid-input-text"
data-child-key="packageName" maxlength="100" data-default=""
placeholder="[ com.google.android.gm ]"/>
</td>
<td>
<tbody data-add-form="#cosu-whitelisted-applications-grid">
<tr data-add-form-element="clone">
<td data-title="No:">
<span class="index"></span>
</td>
<td data-title="Application Name / Description">
<input type="text" class="form-control grid-input-text" data-child-key="appName"
maxlength="100" data-default="" placeholder="[ Application Name / Description ]"/>
</td>
<td data-title="Package Name">
<input type="text" class="form-control grid-input-text" data-child-key="packageName"
maxlength="100" data-default="" placeholder="[ Package Name ]"/>
</td>
<td>
<span class="list-group-item-actions">
<a href="#whitelisted-applications-grid" class="grid-input-remove"
<a href="#cosu-whitelisted-applications-grid" class="grid-input-remove"
data-click-event="remove-form">
<span class="fw-stack helper" title="Remove Entry">
<i class="fw fw-ring fw-stack-2x"></i>
@ -1510,18 +1422,14 @@
</span>
</a>
</span>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--/whitelisted-applications-->
</div>
<!--/android-for-work-cosu-->
</div>
</div>

@ -175,18 +175,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an iOS Device.
Once this configuration profile is installed on a device, corresponding users
will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an iOS Device.
Once this configuration profile is installed on a device, corresponding users
will not be able
to modify these settings on their devices.
</div>
</div>
<div id="passcode-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="passcode-policy-body">
<hr/>
<div id="passcode-policy-feature-error-msg" class="alert alert-danger hidden"
role="alert">
<i class="icon fw fw-error"></i><span></span>
@ -396,17 +395,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configurations can be used to configure VPN settings on an iOS device.
Once this configuration profile is installed on a device, corresponding users will not
be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configurations can be used to configure VPN settings on an iOS device.
Once this configuration profile is installed on a device, corresponding users will not
be able
to modify these settings on their devices.
</div>
</div>
<div id="vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="vpn-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
@ -1200,18 +1199,18 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to configure add-on VPN software (per-app VPN),
and it works only on VPN services of
type 'VPN'. Once this configuration profile is installed on a device,
corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to configure add-on VPN software (per-app VPN),
and it works only on VPN services of
type 'VPN'. Once this configuration profile is installed on a device,
corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="per-app-vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="per-app-vpn-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
@ -1319,16 +1318,16 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to configure app-to-per-app VPN mappings.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to configure app-to-per-app VPN mappings.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="app-to-per-app-vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="app-to-per-app-vpn-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
@ -1418,18 +1417,18 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
These configurations can be used to set how devices connect to your wireless network(s),
including the necessary authentication
information. Once this configuration profile is installed on an iOS device,
corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
These configurations can be used to set how devices connect to your wireless network(s),
including the necessary authentication
information. Once this configuration profile is installed on an iOS device,
corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="wifi-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="wifi-body">
<hr/>
<div id="wifi-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -2281,18 +2280,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
These configurations can be used to define settings for connecting
to your POP or IMAP email accounts.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
These configurations can be used to define settings for connecting
to your POP or IMAP email accounts.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="email-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="email-body">
<hr/>
<div id="email-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -2648,19 +2646,18 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to AirPlay
destinations.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
<br><br>(This feature is supported only on iOS 7.0 and later.)
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to AirPlay
destinations.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
<br><br>(This feature is supported only on iOS 7.0 and later.)
</div>
</div>
<div id="airplay-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="airplay-body">
<hr/>
<div id="airplay-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -2828,15 +2825,14 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr/>
<div class="panel-title-description">
This payload defines web domains that are under an enterprises management.
</div>
</h2>
<div class="panel-title-description">
This payload defines web domains that are under an enterprises management.
</div>
</div>
<div id="domain-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="domain-body">
<hr/>
<div id="DOMAIN-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -2990,18 +2986,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to LDAP
servers.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to LDAP
servers.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="ldap-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="ldap-body">
<hr/>
<div id="ldap-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -3176,18 +3171,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to CalDAV
servers.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to define settings for connecting to CalDAV
servers.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="calendar-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="calendar-body">
<hr/>
<div id="calendar-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -3301,17 +3295,16 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to define settings for calendar subscriptions.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to define settings for calendar subscriptions.
Once this configuration profile is installed on an iOS device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="calendar-subscription-body" class="panel-collapse panel-body collapse"
role="tabpanel" aria-labelledby="calendar-subscription-body">
<hr/>
<div id="calendar-subscription-feature-error-msg" class="alert alert-danger hidden"
role="alert">
<i class="icon fw fw-error"></i><span></span>
@ -3400,19 +3393,18 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
These configurations can be used to specify Access Point Names ( APN ).
Once this configuration profile is installed on an iOS device, corresponding
users will not
be able to modify these settings on their devices.
<br><br>(This feature is not supported on iOS 7.0 and later.)
</div>
</h2>
<div class="panel-title-description">
These configurations can be used to specify Access Point Names ( APN ).
Once this configuration profile is installed on an iOS device, corresponding
users will not
be able to modify these settings on their devices.
<br><br>(This feature is not supported on iOS 7.0 and later.)
</div>
</div>
<div id="apn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="apn-body">
<hr/>
<div id="apn-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -3527,21 +3519,20 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
These configurations can be used to specify Cellular Network Settings on an iOS
device.
Cellular settings cannot be installed if an APN setting is already installed and
upon successful installation, corresponding users will not be able to modify
these
settings on their devices.
<br><br>(This feature is supported only on iOS 7.0 and later.)
</div>
</h2>
<div class="panel-title-description">
These configurations can be used to specify Cellular Network Settings on an iOS
device.
Cellular settings cannot be installed if an APN setting is already installed and
upon successful installation, corresponding users will not be able to modify
these
settings on their devices.
<br><br>(This feature is supported only on iOS 7.0 and later.)
</div>
</div>
<div id="cellular-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="cellular-body">
<hr/>
<div id="cellular-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -3713,18 +3704,17 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
These configurations can be used to restrict apps, device features and
media content available on an iOS device. Once this configuration profile is installed
on a device, corresponding users will not be able to modify these settings on their
devices.
</div>
</h2>
<div class="panel-title-description">
These configurations can be used to restrict apps, device features and
media content available on an iOS device. Once this configuration profile is installed
on a device, corresponding users will not be able to modify these settings on their
devices.
</div>
</div>
<div id="restrictions-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="restrictions-body">
<hr/>
<div id="restrictions-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -4768,16 +4758,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of
applications.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of
applications.
</div>
</div>
<div id="app-restriction-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="app-restriction-body">
<hr/>
<div id="app-restriction-feature-error-msg" class="alert alert-danger hidden"
role="alert">
<i class="icon fw fw-error"></i><span></span>

@ -3,8 +3,7 @@
<a href="javascript:void(0)" onclick="showAdvanceOperation('passcode-policy', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-key fw-stack-2x"></i>
</span>
Passcode Policy
</span>Passcode Policy
<span id="passcode-policy-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="passcode-policy-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="passcode-policy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -78,16 +77,16 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Windows Device.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Windows Device.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="passcode-policy-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="passcode-policy-body">
<hr/>
<div id="passcode-policy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -221,15 +220,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="camera-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="camera-body">
<hr/>
<div id="camera-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -262,15 +261,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to encrypt data on an Windows device, when the device is locked and
make it readable when the passcode is entered. Once this configuration profile is installed on a device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to encrypt data on an Windows device, when the device is locked and
make it readable when the passcode is entered. Once this configuration profile is installed on a device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="encrypt-storage-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="encrypt-storage-body">
<hr/>
<div id="encrypt-storage-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -302,14 +301,13 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of applications.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of applications.
</div>
</div>
<div id="app-restriction-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="app-restriction-body">
<hr/>
<div id="app-restriction-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>

@ -2219,6 +2219,24 @@ var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) {
);
}
};
var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneID, valueSet) {
var selectedValueOnChange = selectElement.value;
var i, slideDownVotes = 0;
for (i = 0; i < valueSet.length; i++) {
if (selectedValueOnChange == valueSet[i]) {
slideDownVotes++;
}
}
var paneSelector = "#" + paneID;
if(slideDownVotes > 0) {
$(paneSelector).removeClass("hidden");
} else {
$(paneSelector).addClass("hidden");
}
};
// End of HTML embedded invoke methods

@ -78,16 +78,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Windows Device.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Windows Device.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="passcode-policy-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="passcode-policy-body">
<hr/>
<div id="passcode-policy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -221,15 +220,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to restrict the usage of camera on an Windows device together with all the applications using the camera.
Once this configuration profile is installed on a device, corresponding users will not be able
to modify these settings on their devices.
</div>
</div>
<div id="camera-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="camera-body">
<hr/>
<div id="camera-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -262,15 +261,15 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to encrypt data on an Windows device, when the device is locked and
make it readable when the passcode is entered. Once this configuration profile is installed on a device,
corresponding users will not be able to modify these settings on their devices.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to encrypt data on an Windows device, when the device is locked and
make it readable when the passcode is entered. Once this configuration profile is installed on a device,
corresponding users will not be able to modify these settings on their devices.
</div>
</div>
<div id="encrypt-storage-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="encrypt-storage-body">
<hr/>
<div id="encrypt-storage-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
@ -303,14 +302,13 @@
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of applications.
</div>
</h2>
<div class="panel-title-description">
This configuration can be used to create a black list or white list of applications.
</div>
</div>
<div id="app-restriction-body" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="app-restriction-body">
<hr/>
<div id="app-restriction-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>

@ -64,6 +64,24 @@
<span id="app-restriction-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="app-restriction-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cosu-system-update-policy', this)">
<span class="wr-hidden-operation-icon fw-stack">
<i class="fw fw-import fw-stack-2x"></i>
</span>
&nbsp;&nbsp;System Update Policy (COSU)
<span id="cosu-system-update-policy-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-system-update-policy-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-system-update-policy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cosu-whitelist-applications', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-register fw-stack-2x"></i>
</span>
Whitelist Apps (COSU)
<span id="cosu-whitelist-applications-configured" class="has-configured status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-whitelist-applications-ok" class="has-success status-icon hidden"><i class="fw fw-ok"></i></span>
<span id="cosu-whitelist-applications-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
@ -633,7 +651,7 @@
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input id="disable-screen-capture-enabled" type="checkbox" class="operationDataKeys"
data-key="diableScreenCapture"/>
data-key="disableScreenCapture"/>
<span class="helper" title="Having this checked would disable screen capture .">
&nbsp;&nbsp;&nbsp;Disable screen capture
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
@ -1223,5 +1241,257 @@
</div>
</div>
</div>
<!-- cosu-system-update-policy -->
<div class="wr-hidden-operation" data-operation="cosu-system-update-policy">
<div class="panel panel-default operation-data" data-operation="cosu-system-update-policy"
data-operation-code="SYSTEM_UPDATE_POLICY">
<div id="cosu-system-update-policy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
System Update Policy (COSU)
<label id="cosu-system-update-policy-lbl" class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cosu-system-update-policy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Android Device.
Once this configuration profile is installed on a device, corresponding users will not be
able
to modify these settings on their devices.
</div>
</h2>
</div>
<div id="cosu-system-update-policy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="cosu-system-update-policy-body">
<div id="cosu-system-update-policy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label">
System Update
<span class="helper" title="Type of the System Update to be set by the Device Owner">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<br><br>
<label class="wr-input-control radio light">
<input id="automatic-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="automatic" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])" checked disabled/>
<span class="helper" title="Installs system update automatically as soon as one is available">
&nbsp;Automatic
</span>
</label>
<label class="wr-input-control radio light">
<input id="postpone-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="postpone" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])" disabled/>
<span class="helper" title="Incoming system update will be blocked for a maximum of 30 days">
&nbsp;Postpone
</span>
</label>
<label class="wr-input-control radio light">
<input id="window-system-update-radio-btn" type="radio" name="cosu-system-update-type"
class="form-control operationDataKeys" data-key="cosuSystemUpdatePolicyType"
value="window" onclick="slideDownPaneAgainstValueSetForRadioButtons(this, 'cosu-system-update-policy-window-select', ['window'])" disabled/>
<span class="helper" title="Install system update automatically within a daily maintenance window, for a maximum of 30 days">
&nbsp;Window
</span>
</label>
</div>
<div id="cosu-system-update-policy-window-select" class="hidden">
<div>
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="cosu-system-update-policy-window-select-msg">
Below configuration of start time and end time are valid only when
<b>window</b> option is selected.
</a>
</ul>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="cosu-system-update-policy-window-start-time">
Start Time
<span class="helper" title="Window start time for system update">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="cosu-system-update-policy-window-start-time"
class="form-control operationDataKeys"
data-key="cosuSystemUpdatePolicyWindowStartTime" data-default="0">
<option value="1440" selected="selected">12 AM</option>
<option value="60">1 AM</option>
<option value="120">2 AM</option>
<option value="180">3 AM</option>
<option value="240">4 AM</option>
<option value="300">5 AM</option>
<option value="360">6 AM</option>
<option value="420">7 AM</option>
<option value="480">8 AM</option>
<option value="540">9 AM</option>
<option value="600">10 AM</option>
<option value="660">11 AM</option>
<option value="720">12 noon</option>
<option value="780">1 PM</option>
<option value="840">2 PM</option>
<option value="900">3 PM</option>
<option value="960">4 PM</option>
<option value="1020">5 PM</option>
<option value="1080">6 PM</option>
<option value="1140">7 PM</option>
<option value="1200">8 PM</option>
<option value="1260">9 PM</option>
<option value="1320">10 PM</option>
<option value="1380">11 PM</option>
</select>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="cosu-system-update-policy-window-end-time">
End Time
<span class="helper" title="Window end time for system update">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="cosu-system-update-policy-window-end-time"
class="form-control operationDataKeys"
data-key="cosuSystemUpdatePolicyWindowEndTime" data-default="0">
<option value="1440" selected="selected">12 AM</option>
<option value="60">1 AM</option>
<option value="120">2 AM</option>
<option value="180">3 AM</option>
<option value="240">4 AM</option>
<option value="300">5 AM</option>
<option value="360">6 AM</option>
<option value="420">7 AM</option>
<option value="480">8 AM</option>
<option value="540">9 AM</option>
<option value="600">10 AM</option>
<option value="660">11 AM</option>
<option value="720">12 Noon</option>
<option value="780">1 PM</option>
<option value="840">2 PM</option>
<option value="900">3 PM</option>
<option value="960">4 PM</option>
<option value="1020">5 PM</option>
<option value="1080">6 PM</option>
<option value="1140">7 PM</option>
<option value="1200">8 PM</option>
<option value="1260">9 PM</option>
<option value="1320">10 PM</option>
<option value="1380">11 PM</option>
</select>
</div>
</div>
</div>
</div>
</div>
<!-- cosu-whitelist-applications -->
<div class="wr-hidden-operation" data-operation="cosu-whitelist-applications">
<div class="panel panel-default operation-data" data-operation="cosu-whitelist-applications"
data-operation-code="KIOSK_APPS">
<div id="cosu-whitelist-applications-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Whitelist Applications (COSU)
<label id="cosu-whitelist-applications-lbl" class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cosu-whitelist-applications-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
<hr>
<div class="panel-title-description">
This configuration can be used to set a passcode policy to an Android Device.
Once this configuration profile is installed on a device, corresponding users will not be
able
to modify these settings on their devices.
</div>
</h2>
</div>
<div id="cosu-whitelist-applications-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="cosu-whitelist-applications-body">
<div id="cosu-whitelist-applications-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="cosu-whitelisted-applications">
Whitelisted Applications to enter Lock Task Mode
<span class="helper" title="Configuration information specific to a given third-party VPN solution. This has to be input as key/value pairs.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
<a href="#cosu-whitelisted-applications-grid" class="grid-input-add" data-click-event="add-form">
<span class="icon fw-stack">
<i class="fw fw-add fw-stack-1x"></i>
<i class="fw fw-ring fw-stack-2x"></i>
</span>
&nbsp;
Add Application
</a>
</label>
<div id="cosu-whitelisted-applications"
class="operationDataKeys grouped-array-input multi-column-key-value-pair-array"
data-key="cosuWhitelistedApplications" data-column-count="2">
<table class="table table-responsive table-striped">
<thead>
<tr>
<th>No:</th>
<th>Application Name / Description</th>
<th>Package Name</th>
<th></th>
</tr>
</thead>
<tbody data-add-form-container="#cosu-whitelisted-applications-grid">
<tr data-help-text="add-form">
<td colspan="4">
No entries added yet .
</td>
</tr>
</tbody>
</table>
<table class="template hidden">
<tbody data-add-form="#cosu-whitelisted-applications-grid">
<tr data-add-form-element="clone">
<td data-title="No:">
<span class="index"></span>
</td>
<td data-title="Application Name / Description">
<input type="text" class="form-control grid-input-text" data-child-key="appName"
maxlength="100" data-default="" placeholder="[ Application Name / Description ]" disabled/>
</td>
<td data-title="Package Name">
<input type="text" class="form-control grid-input-text" data-child-key="packageName"
maxlength="100" data-default="" placeholder="[ Package Name ]" disabled/>
</td>
<td>
<span class="list-group-item-actions">
<a href="#cosu-whitelisted-applications-grid" class="grid-input-remove"
data-click-event="remove-form">
<span class="fw-stack helper" title="Remove Entry">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-delete fw-stack-1x"></i>
</span>
</a>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -22,15 +22,16 @@
{{/zone}}
{{#zone "navMenu-items"}}
<li>
<a href="{{@app.context}}">
<i class="fw fw-dashboard"></i>
Admin Dashboard
</a>
</li>
<li>
<a href="{{@app.context}}">
<i class="fw fw-dashboard"></i>
Resource Dashboard
</a>
</li>
{{#if permissions.LIST_DEVICES}}
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/devices">
<i class="fw fw-mobile"></i>
Device Management
@ -38,33 +39,41 @@
</li>
{{/if}}
<li><a><i class="fw fw-user"></i>User Management</a>
<ul>
{{#if permissions.LIST_USERS}}
<li><a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
{{/if}}
{{#if permissions.LIST_ROLES}}
<li><a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
{{/if}}
</ul>
</li>
{{#if permissions.USER_MGT_PERMITTED}}
<li><a><i class="fw fw-user"></i>User Management</a>
<ul>
{{#if permissions.LIST_USERS}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
{{/if}}
{{#if permissions.LIST_ROLES}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
{{/if}}
</ul>
</li>
{{/if}}
{{#if permissions.LIST_POLICIES}}
<li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
{{/if}}
{{#if permissions.CONFIG_MGT_PERMITTED}}
<li><a><i class="fw fw-settings"></i>Configuration Management</a>
<ul>
{{#if permissions.LIST_PLATFORM_CONFIGURATIONS}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
</li>
{{/if}}
<!-- todo change the permission and get the related permission -->
{{#if permissions.LIST_CERTIFICATES}}
<li><!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
</li>
{{/if}}
</ul>
</li>
{{/if}}
<li><a><i class="fw fw-settings"></i>Configuration Management</a>
<ul>
{{#if permissions.LIST_CONFIGURATION}}
<li><a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
</li>
{{/if}}
<!-- todo change the permission and get the related permission -->
{{#if permissions.LIST_CONFIGURATION}}
<li><a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
</li>
{{/if}}
</ul>
</li>
{{/zone}}
{{#zone "navbarCollapsableRightItems"}}
@ -83,15 +92,18 @@
</ul>
{{/zone}}
{{#zone "sidePanes"}}
<!--suppress HtmlUnknownAttribute -->
<div class="sidebar-wrapper" id="right-sidebar" is-authorized="{{permissions.LIST_NOTIFICATIONS}}"
data-side="right" data-width="320" data-sidebar-fixed="true" data-fixed-offset="50" data-spy="affix"
data-offset-top="80">
<ul class="sidebar-messages">
</ul>
<div class="text-center"><a href="{{appContext}}notification-listing" class="btn btn-primary">Show all notifications</a></div>
data-side="right" data-width="320" data-sidebar-fixed="true" data-fixed-offset="60" data-spy="affix"
data-offset-top="80">
<br>
<ul class="sidebar-messages"></ul>
<br>
<div class="text-center"><a href="{{appContext}}notification-listing" class="btn btn-primary">Show All Notifications</a></div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="notifications" data-current-user="{{currentUser.username}}"
data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notifications.hbs"
type="text/x-handlebars-template"></script>

@ -43,16 +43,20 @@ function onRequest(context) {
// eg: {{unit "appbar" pageLink="users" title="User Management"}}
viewModel["currentActions"] = links[viewModel["pageLink"]];
viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
var currentUser = session.get(constants["USER_SESSION_KEY"]);
viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]);
var permissions = {};
permissions.LIST_DEVICES = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
permissions.LIST_POLICIES = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions.LIST_ROLES = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions.LIST_USERS = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions.LIST_NOTIFICATIONS = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
permissions.LIST_CONFIGURATION = userModule.isAuthorized("/permission/admin/device-mgt/configurations/view");
viewModel.permissions = permissions;
viewModel["currentUser"] = currentUser;
permissions["LIST_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
permissions["LIST_POLICIES"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
permissions["LIST_USERS"] = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
permissions["LIST_ROLES"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
permissions["USER_MGT_PERMITTED"] = (permissions["LIST_USERS"] || permissions["LIST_ROLES"]);
permissions["LIST_PLATFORM_CONFIGURATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/platform-configurations/view");
permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view");
permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]);
permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
viewModel["permissions"] = permissions;
viewModel["appContext"] = mdmProps["appContext"];
return viewModel;

@ -117,7 +117,7 @@ function loadNewNotifications() {
var currentUser = notifications.data("currentUser");
$.template("notification-listing", notifications.attr("src"), function (template) {
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
var serviceURL = emmAdminBasePath + "/notifications?offset=0&limit=5&status=NEW";
invokerUtil.get(
serviceURL,
// on success
@ -128,21 +128,27 @@ function loadNewNotifications() {
if (responsePayload["notifications"]) {
if (responsePayload.count > 0) {
viewModel["notifications"] = responsePayload["notifications"];
// viewModel["appContext"] = context;
$(messageSideBar).html(template(viewModel));
} else {
$(messageSideBar).html('<div class="alert alert-info" role="alert"><i class="icon fw fw-info"></i>No new notifications found...</div>');
$(messageSideBar).html(
"<h4 class='text-center'>No New Notifications</h4>" +
"<h5 class='text-center text-muted'>" +
"Check this section for error notifications<br>related to device operations" +
"</h5>"
);
}
} else {
$(messageSideBar).html("<h4 class ='message-danger'>Unexpected error " +
"occurred while loading new notifications.</h4>");
$(messageSideBar).html("<h4 class ='message-danger text-center'>Unexpected error " +
"occurred while loading new notifications</h4>");
}
}
},
// on error
function (jqXHR) {
if (jqXHR.status = 500) {
$(messageSideBar).html("<h4 class ='message-danger'>Unexpected error occurred while trying " +
"to retrieve any new notifications.</h4>");
$(messageSideBar).html("<h4 class ='message-danger text-center'>Unexpected error occurred while trying " +
"to retrieve any new notifications</h4>");
}
}
);

@ -2,11 +2,11 @@
<li class="message message-info" data-type="selectable" >
<h4>
<i class="icon fw fw-info"></i>
<a href="device?type={{deviceIdentifier.type}}&id={{deviceIdentifier.id}}"
data-id="{{notificationId}}"
data-url="device?type={{deviceIdentifier.type}}&id={{deviceIdentifier.id}}"
class="new-notification" data-click-event="remove-form">
Device Type : {{deviceIdentifier.type}}
<a href="{{../appContext}}/device/{{deviceType}}?id={{deviceIdentifier}}#event_log_tab"
data-id="{{operationId}}"
data-url="device/{{deviceType}}?id={{deviceIdentifier}}#event_log_tab"
class="new-notification text-capitalize" data-click-event="remove-form">
{{deviceType}} {{deviceName}}
</a>
</h4>
<p>{{description}}</p>

@ -312,7 +312,7 @@ deviceModule = function () {
var url;
var license;
if (deviceType == "windows") {
url = devicemgtProps["httpURL"] + "/mdm-windows-agent/services/device/license";
url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/services/configuration/license";
} else if (deviceType == "ios") {
url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/";
}

@ -63,7 +63,7 @@ if (platform != "Windows Phone") {
var status = restAPIResponse["status"];
if (status == 200) {
session.put("authenticatedUser", username);
session.put("windowsBinaryToken", parse(xmlHttpRequest["responseText"]).UserToken);
session.put("windowsBinaryToken", parse(restAPIResponse["responseText"]).UserToken);
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/license-agent");
} else if (status == 403) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=auth-failed");

@ -36,10 +36,10 @@ if (platform != "Windows Phone") {
if (!authenticatedUser) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request");
} else {
var enrollmentUtils = require("/modules/enrollments/util/utils.js")["methods"];
var Handlebars = require("/lib/handlebars-v2.0.0.js")["Handlebars"];
var enrollmentUtils = require("/app/modules/enrollments/util/utils.js")["methods"];
var Handlebars = require("/lib/modules/handlebars/handlebars-v2.0.0.js")["Handlebars"];
var template = Handlebars.compile(enrollmentUtils.
getResource("/modules/enrollments/windows/config/workplace-switch-request-template.hbs"));
getResource("/app/modules/enrollments/windows/config/workplace-switch-request-template.hbs"));
var windowsWorkplaceAppID = session.get("windowsWorkplaceAppID");
var windowsBinaryToken = session.get("windowsBinaryToken");

@ -6,7 +6,7 @@
@base-dark-color: #11375B;
@base-light-color: #ffffff;
@base-success-color: #5cb85c;
@base-info-color: #009DA7;
@base-info-color: #526A84;
@base-warning-color: #f0ad4e;
@base-danger-color: #d9534f;

@ -263,6 +263,13 @@ public final class PluginConstants {
}
public static final int MULTI_STATUS_HTTP_CODE = 207;
}
public final class WindowsConstant {
public static final String DEVICE_TYPE_WINDOWS = "windows";
public static final String HEADER_CONTENT_TYPE = "Content-Type";
public static final String APPLICATION_JSON = "application/json";
}
/**
@ -282,6 +289,7 @@ public final class PluginConstants {
public static final String DEFAULT_AUTH_POLICY = "Federated";
}
/**
* Policy Configuration related constants.
*/

@ -0,0 +1,86 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
import java.util.ArrayList;
import java.util.List;
public class ErrorDTO {
private Long code = null;
private String message = null;
private String description = null;
public void setMoreInfo(String moreInfo) {
this.moreInfo = moreInfo;
}
public void setCode(Long code) {
this.code = code;
}
public void setMessage(String message) {
this.message = message;
}
public void setDescription(String description) {
this.description = description;
}
public void setError(List<ErrorDTO> error) {
this.error = error;
}
private String moreInfo = null;
public String getMessage() {
return message;
}
public Long getCode() {
return code;
}
public String getDescription() {
return description;
}
public String getMoreInfo() {
return moreInfo;
}
public List<ErrorDTO> getError() {
return error;
}
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("class ErrorDTO {\n");
stringBuilder.append(" code: ").append(code).append("\n");
stringBuilder.append(" message: ").append(message).append("\n");
stringBuilder.append(" description: ").append(description).append("\n");
stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n");
stringBuilder.append(" error: ").append(error).append("\n");
stringBuilder.append("}\n");
return stringBuilder.toString();
}
private List<ErrorDTO> error = new ArrayList<>();
}

@ -0,0 +1,77 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
@ApiModel(description = "")
public class ErrorListItem {
@NotNull
private String code = null;
@NotNull
private String message = null;
@ApiModelProperty(required = true, value = "")
@JsonProperty("code")
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ErrorListItem() {}
public ErrorListItem(String code, String msg) {
this.code = code;
this.message = msg;
}
/**
* Description about individual errors occurred
**/
@ApiModelProperty(required = true, value = "Description about individual errors occurred")
@JsonProperty("message")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("errorItem {\n");
sb.append(" code: ").append(code).append("\n");
sb.append(" message: ").append(message).append("\n");
sb.append("}\n");
return sb.toString();
}
}

@ -0,0 +1,167 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.common.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
public class ErrorResponse {
private Long code = null;
private String message = null;
private String description = null;
private String moreInfo = null;
private List<ErrorListItem> errorItems = new ArrayList<>();
@JsonProperty(value = "code")
@ApiModelProperty(required = true, value = "")
public Long getCode() {
return code;
}
public void setCode(Long code) {
this.code = code;
}
@JsonProperty(value = "message")
@ApiModelProperty(required = true, value = "ErrorResponse message.")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@JsonProperty(value = "description")
@ApiModelProperty(value = "A detail description about the error message.")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@JsonProperty(value = "moreInfo")
@ApiModelProperty(value = "Preferably an url with more details about the error.")
public String getMoreInfo() {
return moreInfo;
}
public void setMoreInfo(String moreInfo) {
this.moreInfo = moreInfo;
}
public void addErrorListItem(ErrorListItem item) {
this.errorItems.add(item);
}
/**
* If there are more than one error list them out. \nFor example, list out validation errors by each field.
*/
@JsonProperty(value = "errorItems")
@ApiModelProperty(value = "If there are more than one error list them out. \n" +
"For example, list out validation errors by each field.")
public List<ErrorListItem> getErrorItems() {
return errorItems;
}
public void setErrorItems(List<ErrorListItem> error) {
this.errorItems = error;
}
@Override
public String toString() {
// StringBuilder sb = new StringBuilder();
// sb.append("{");
// boolean cont = false;
// if (code != null) {
// cont = true;
// sb.append(" \"code\": ").append(code);
// }
// if (message != null) {
// if (cont) {
// sb.append(",");
// }
// cont = true;
// sb.append(" \"message\": \"").append(message).append("\"");
// }
// if (description != null) {
// if (cont) {
// sb.append(",");
// }
// cont = true;
// sb.append(" \"description\": ").append(description).append("\"");
// }
// if (moreInfo != null) {
// if (cont) {
// sb.append(",");
// }
// cont = true;
// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\"");
// }
// if (error != null && error.size() > 0) {
// if (cont) {
// sb.append(",");
// }
// sb.append(" \"errorItems\": ").append(error);
// }
// sb.append("}");
// return sb.toString();
return null;
}
public static class ErrorResponseBuilder {
private Long code = null;
private String message = null;
private String description = null;
private String moreInfo = null;
private List<ErrorListItem> error;
public ErrorResponseBuilder() {
this.error = new ArrayList<>();
}
public ErrorResponseBuilder setCode(long code) {
this.code = code;
return this;
}
public ErrorResponseBuilder setMessage(String message) {
this.message = message;
return this;
}
public ErrorResponseBuilder setDescription(String description) {
this.description = description;
return this;
}
public ErrorResponseBuilder setMoreInfo(String moreInfo) {
this.moreInfo = moreInfo;
return this;
}
public ErrorResponseBuilder addErrorItem(String code, String msg) {
ErrorListItem item = new ErrorListItem();
item.setCode(code);
item.setMessage(msg);
this.error.add(item);
return this;
}
public ErrorResponse build() {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setCode(code);
errorResponse.setMessage(message);
errorResponse.setErrorItems(error);
errorResponse.setDescription(description);
errorResponse.setMoreInfo(moreInfo);
return errorResponse;
}
}
}

@ -18,10 +18,9 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
@ -29,8 +28,7 @@ import javax.ws.rs.core.Response;
*/
public class BadRequestException extends WebApplicationException {
public BadRequestException(Message message, MediaType mediaType) {
super(Response.status(Response.Status.BAD_REQUEST).entity(message).
type(mediaType).build());
public BadRequestException(ErrorResponse error) {
super(Response.status(Response.Status.BAD_REQUEST).entity(error).build());
}
}

@ -0,0 +1,49 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorDTO;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
public class UnexpectedServerErrorException extends WebApplicationException {
private String message;
private static final long serialVersionUID = 147943579458906890L;
public UnexpectedServerErrorException(ErrorResponse error) {
super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build());
}
public UnexpectedServerErrorException(ErrorDTO errorDTO) {
super(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(errorDTO)
.header(PluginConstants.WindowsConstant.HEADER_CONTENT_TYPE, PluginConstants.WindowsConstant.APPLICATION_JSON)
.build());
message = errorDTO.getDescription();
}
@Override
public String getMessage() {
return message;
}
}

@ -18,18 +18,24 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.common.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -42,6 +48,7 @@ import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
/**
@ -49,6 +56,8 @@ import java.util.List;
*/
public class WindowsAPIUtils {
private static Log log = LogFactory.getLog(WindowsAPIUtils.class);
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) {
DeviceIdentifier identifier = new DeviceIdentifier();
identifier.setId(deviceId);
@ -87,21 +96,25 @@ public class WindowsAPIUtils {
return responseMediaType;
}
public static Response getOperationResponse(List<String> deviceIDs, Operation operation,
Message message, MediaType responseMediaType)
throws DeviceManagementException, OperationManagementException {
WindowsDeviceUtils deviceUtils = new WindowsDeviceUtils();
DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs,
message, responseMediaType);
// getDeviceManagementService().addOperation(operation, deviceIDHolder.getValidDeviceIDList());
if (!deviceIDHolder.getInvalidDeviceIdList().isEmpty()) {
return Response.status(PluginConstants.StatusCodes.
MULTI_STATUS_HTTP_CODE).type(
responseMediaType).entity(deviceUtils.
convertErrorMapIntoErrorMessage(deviceIDHolder.getInvalidDeviceIdList())).build();
public static Response getOperationResponse(List<String> deviceIDs, Operation operation)
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
if (deviceIDs == null || deviceIDs.size() == 0) {
String errorMessage = "Device identifier list is empty";
log.error(errorMessage);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
DeviceIdentifier deviceIdentifier;
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
for (String deviceId : deviceIDs) {
deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(PluginConstants.WindowsConstant.DEVICE_TYPE_WINDOWS);
deviceIdentifiers.add(deviceIdentifier);
}
return Response.status(Response.Status.CREATED).
type(responseMediaType).build();
Activity activity = getDeviceManagementService().addOperation(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, operation, deviceIdentifiers);
return Response.status(Response.Status.CREATED).entity(activity).build();
}
public static PolicyManagerService getPolicyManagerService() {
@ -126,8 +139,8 @@ public class WindowsAPIUtils {
throws OperationManagementException, DeviceManagementException {
List<? extends Operation> pendingDataOperations;
pendingDataOperations = org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils.
getDeviceManagementService().getOperationsByDeviceAndStatus(
deviceIdentifier, Operation.Status.PENDING);
getDeviceManagementService().getOperationsByDeviceAndStatus(
deviceIdentifier, Operation.Status.PENDING);
return pendingDataOperations;
}

@ -1,86 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.mobile.windows.api.common.util;
import org.apache.commons.lang.StringUtils;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;
/**
* Class for get windows device utilities.
*/
public class WindowsDeviceUtils {
private static final String COMMA_SEPARATION_PATTERN = ", ";
public DeviceIDHolder validateDeviceIdentifiers(List<String> deviceIDs,
Message message, MediaType responseMediaType) {
if (deviceIDs == null) {
message.setResponseMessage("Device identifier list is empty");
throw new BadRequestException(message, responseMediaType);
}
List<String> errorDeviceIdList = new ArrayList<>();
List<DeviceIdentifier> validDeviceIDList = new ArrayList<>();
int deviceIDCounter = 0;
for (String deviceID : deviceIDs) {
deviceIDCounter++;
if (deviceID == null || deviceID.isEmpty()) {
errorDeviceIdList.add(String.format(PluginConstants.DeviceConstants.DEVICE_ID_NOT_FOUND,
deviceIDCounter));
continue;
}
try {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceID);
deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.
MOBILE_DEVICE_TYPE_WINDOWS);
Device device = WindowsAPIUtils.getDeviceManagementService().
getDevice(deviceIdentifier);
if (device == null || device.getDeviceIdentifier() == null ||
device.getDeviceIdentifier().isEmpty()) {
errorDeviceIdList.add(String.format(PluginConstants.DeviceConstants.DEVICE_ID_NOT_FOUND,
deviceIDCounter));
continue;
}
validDeviceIDList.add(deviceIdentifier);
} catch (DeviceManagementException e) {
errorDeviceIdList.add(String.format(PluginConstants.DeviceConstants.DEVICE_ID_SERVICE_NOT_FOUND,
deviceIDCounter));
}
}
DeviceIDHolder deviceIDHolder = new DeviceIDHolder();
deviceIDHolder.setValidDeviceIDList(validDeviceIDList);
deviceIDHolder.setInvalidDeviceIdList(errorDeviceIdList);
return deviceIDHolder;
}
public String convertErrorMapIntoErrorMessage(List<String> errorDeviceIdList) {
return StringUtils.join(errorDeviceIdList.iterator(), COMMA_SEPARATION_PATTERN);
}
}

@ -18,15 +18,17 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.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.util.Message;
import javax.jws.WebService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* Windows Platform Configuration REST-API implementation.
@ -35,32 +37,55 @@ import javax.ws.rs.*;
@API(name = "Windows Configuration Management", version = "1.0.0",
context = "api/device-mgt/windows/v1.0/services/configuration",
tags = {"windows"})
@Api(value = "Windows Configuration Management",
description = "This carries all the resources related to Windows configurations management functionalities")
@WebService
@Path("services/configuration")
@Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
@Path("services/configuration")
public interface ConfigurationMgtService {
/**
* Save Tenant configurations.
*
* @param configuration Tenant Configurations to be saved.
* @return Message type object for the provide save status.
* @throws WindowsConfigurationException
*/
@POST
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException;
/**
* Retrieve Tenant configurations according to the device type.
*
* @return Tenant configuration object contains specific tenant configurations.
* @throws WindowsConfigurationException
*/
@GET
@Permission(name = "View Configurations", permission = "/device-mgt/configurations/view")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Windows Platform Configurations",
notes = "Get the Windows platform configuration details using this REST API",
response = PlatformConfiguration.class,
tags = "Windows Configuration Management"
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched Windows platform configuration.",
response = PlatformConfiguration.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource to be deleted does not exist."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Windows platform configuration.")
})
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
/**
@ -71,6 +96,98 @@ public interface ConfigurationMgtService {
* @throws WindowsConfigurationException
*/
@PUT
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Updating Windows Platform Configuration.",
notes = "Update the Windows platform configurations using this REST API.",
tags = "Windows Configuration Management"
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK. \n Windows platform configuration has been updated successfully",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "URL of the updated Windows platform configuration."),
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource to be deleted does not exist."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while modifying Windows platform configuration.")
})
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException;
Message updateConfiguration( @ApiParam(name = "configuration",
value = "PlatformConfiguration")PlatformConfiguration configuration) throws WindowsConfigurationException;
@GET
@Path("license")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(
produces = MediaType.TEXT_PLAIN,
httpMethod = "GET",
value = "Getting the License Agreement for Windows Device Registration",
notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " +
"registration process",
response = String.class,
tags = "Windows Configuration Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched Windows license configuration.",
response = String.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "Content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource to be deleted does not exist."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching Windows license configuration.")
})
Response getLicense(
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException;
}

@ -18,10 +18,17 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import javax.ws.rs.*;
import javax.jws.WebService;
import javax.ws.rs.Consumes;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@ -29,6 +36,12 @@ import java.util.List;
/**
* Interface for Admin operations persisting. This interface accepts operations added via UI.
*/
@Api(value = "Windows Device Management Administrative Service",
description = "Device management related admin APIs.")
@API(name = "Windows Device Management Administrative Service", version = "1.0.0",
context = "api/device-mgt/windows/v1.0/admin/devices",
tags = {"devicemgt_windows"})
@WebService
@Path("/admin/devices")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ -36,7 +49,7 @@ public interface DeviceManagementAdminService {
@POST
@Path("/lock-devices")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/windows/lock")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock")
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@ -48,19 +61,19 @@ public interface DeviceManagementAdminService {
@POST
@Path("/wipe-devices")
@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning/operations/windows/wipe")
@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe")
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/ring-devices")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/windows/ring")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring")
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException;
@POST
@Path("/lockreset-devices")
@Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning/operations/windows/lockreset")
@Path("/lock-reset-devices")
@Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock-reset")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds)
throws WindowsDeviceEnrolmentException;
}

@ -18,20 +18,31 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
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 javax.jws.WebService;
import javax.ws.rs.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;
/**
* Windows Device Management REST-API implementation.
* All end points supports JSON, XMl with content negotiation.
* Windows Device Management REST-API implementation. All end points supports JSON, XMl with content negotiation.
*/
@Api(value = "Windows Device Management",
description = "This carries all the resources related to Windows device management functionalities")
@API(name = "Windows Device Management", version = "1.0.0",
context = "api/device-mgt/windows/v1.0/devices",
tags = {"devicemgt_windows"})
@WebService
@Path("/devices")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@ -61,14 +72,15 @@ public interface DeviceManagementService {
/**
* Update Windows device details of given device id.
*
* @param deviceId Device Id.
* @param device Device details to be updated.
* @param deviceId Device Id.
* @param device Device details to be updated.
* @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info.
*/
@PUT
@Path("{id}")
Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException;
/**
* Fetch the Licence agreement for specific windows platform.
*

@ -26,6 +26,8 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException;
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.WindowsAPIUtils;
@ -46,58 +48,6 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
private static Log log = LogFactory.getLog(
org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.ConfigurationMgtServiceImpl.class);
/**
* Save Tenant configurations.
*
* @param configuration Tenant Configurations to be saved.
* @return Message type object for the provide save status.
* @throws WindowsConfigurationException
*/
@POST
public Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException {
Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null;
String message;
try {
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
if (!configuration.getConfiguration().isEmpty()) {
List<ConfigurationEntry> configs = configuration.getConfiguration();
for (ConfigurationEntry entry : configs) {
if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) {
License license = new License();
license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
license.setLanguage(PluginConstants.TenantConfigProperties.LANGUAGE_US);
license.setVersion("1.0.0");
license.setText(entry.getValue().toString());
WindowsAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, license);
licenseEntry = entry;
}
}
if (licenseEntry != null) {
configs.remove(licenseEntry);
}
configuration.setConfiguration(configs);
WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
Response.status(Response.Status.CREATED);
responseMsg.setResponseMessage("Windows platform configuration saved successfully.");
responseMsg.setResponseCode(Response.Status.CREATED.toString());
return responseMsg;
} else {
Response.status(Response.Status.BAD_REQUEST);
responseMsg.setResponseMessage("Windows platform configuration can not be saved.");
responseMsg.setResponseCode(Response.Status.CREATED.toString());
}
} catch (DeviceManagementException e) {
message = "Error Occurred while configuring Windows Platform.";
log.error(message, e);
throw new WindowsConfigurationException(message, e);
}
return responseMsg;
}
/**
* Retrieve Tenant configurations according to the device type.
*
@ -182,4 +132,24 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
}
return responseMsg;
}
@GET
@Path("/license")
public Response getLicense(
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
License license;
try {
license =
WindowsAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Windows device enrolment";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
return Response.status(Response.Status.OK).entity(license).build();
}
}

@ -22,10 +22,13 @@ import com.ibm.wsdl.OperationImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsOperationsException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
@ -69,7 +72,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setCode(PluginConstants.OperationCodes.DEVICE_LOCK);
operation.setType(Operation.Type.COMMAND);
operation.setEnabled(true);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation, message, responseMediaType);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
message.setResponseMessage(errorMessage);
@ -82,6 +85,11 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
log.error(errorMessage, e);
throw new WindowsOperationsException(message, responseMediaType);
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
}
@ -105,7 +113,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setType(Operation.Type.COMMAND);
operation.setEnabled(true);
try {
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation, message, responseMediaType);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
message.setResponseMessage(errorMessage);
@ -118,7 +126,12 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
log.error(errorMessage, e);
throw new WindowsOperationsException(message, responseMediaType);
}
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
}
/**
@ -143,7 +156,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setCode(PluginConstants.OperationCodes.WIPE_DATA);
operation.setType(Operation.Type.COMMAND);
try {
return WindowsAPIUtils.getOperationResponse(deviceids, operation, message, responseMediaType);
return WindowsAPIUtils.getOperationResponse(deviceids, operation);
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
message.setResponseMessage(errorMessage);
@ -156,6 +169,11 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
log.error(errorMessage, e);
throw new WindowsOperationsException(message, responseMediaType);
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
}
@ -181,7 +199,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
CommandOperation operation = new CommandOperation();
operation.setCode(PluginConstants.OperationCodes.DEVICE_RING);
operation.setType(Operation.Type.COMMAND);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation, message, responseMediaType);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
message.setResponseMessage(errorMessage);
@ -194,6 +212,11 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
log.error(errorMessage, e);
throw new WindowsOperationsException(message, responseMediaType);
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
}
@ -224,7 +247,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
CommandOperation operation = new CommandOperation();
operation.setCode(PluginConstants.OperationCodes.LOCK_RESET);
operation.setType(Operation.Type.COMMAND);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation, message, responseMediaType);
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance";
message.setResponseMessage(errorMessage);
@ -237,6 +260,11 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
log.error(errorMessage, e);
throw new WindowsOperationsException(message, responseMediaType);
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers found.";
log.error(errorMessage, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
}
}

Loading…
Cancel
Save