|
|
@ -16,17 +16,20 @@
|
|
|
|
* under the License.
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function onRequest(context) {
|
|
|
|
function onRequest() {
|
|
|
|
var DTYPE_CONF_DEVICE_TYPE_KEY = "deviceType";
|
|
|
|
var log = new Log("/app/units/mdm.unit.policy.create");
|
|
|
|
var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utility = require("/app/modules/utility.js").utility;
|
|
|
|
var CONF_DEVICE_TYPE_KEY = "deviceType";
|
|
|
|
|
|
|
|
var CONF_DEVICE_TYPE_LABEL_KEY = "label";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var utility = require("/app/modules/utility.js")["utility"];
|
|
|
|
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
|
|
|
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
|
|
|
|
|
|
|
|
|
|
|
var types = {};
|
|
|
|
var viewModelData = {};
|
|
|
|
types["types"] = [];
|
|
|
|
viewModelData["types"] = [];
|
|
|
|
var typesListResponse = userModule.getPlatforms();
|
|
|
|
var typesListResponse = userModule.getPlatforms();
|
|
|
|
var deviceTypes = typesListResponse["content"]["deviceTypes"];
|
|
|
|
var deviceTypes = typesListResponse["content"]["deviceTypes"];
|
|
|
|
|
|
|
|
|
|
|
|
if (typesListResponse["status"] == "success") {
|
|
|
|
if (typesListResponse["status"] == "success") {
|
|
|
|
for (var i = 0; i < deviceTypes.length; i++) {
|
|
|
|
for (var i = 0; i < deviceTypes.length; i++) {
|
|
|
|
var content = {};
|
|
|
|
var content = {};
|
|
|
@ -34,16 +37,25 @@ function onRequest(context) {
|
|
|
|
content["name"] = deviceType;
|
|
|
|
content["name"] = deviceType;
|
|
|
|
var configs = utility.getDeviceTypeConfig(deviceType);
|
|
|
|
var configs = utility.getDeviceTypeConfig(deviceType);
|
|
|
|
var deviceTypeLabel = deviceType;
|
|
|
|
var deviceTypeLabel = deviceType;
|
|
|
|
if (configs && configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY]) {
|
|
|
|
if (configs && configs[CONF_DEVICE_TYPE_KEY][CONF_DEVICE_TYPE_LABEL_KEY]) {
|
|
|
|
deviceTypeLabel = configs[DTYPE_CONF_DEVICE_TYPE_KEY][DTYPE_CONF_DEVICE_TYPE_LABEL_KEY];
|
|
|
|
deviceTypeLabel = configs[CONF_DEVICE_TYPE_KEY][CONF_DEVICE_TYPE_LABEL_KEY];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var policyWizard = new File("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard"));
|
|
|
|
var policyWizard = new File("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.error("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard"));
|
|
|
|
|
|
|
|
|
|
|
|
if (policyWizard.isExists()) {
|
|
|
|
if (policyWizard.isExists()) {
|
|
|
|
content["icon"] = utility.getDeviceThumb(deviceType);
|
|
|
|
content["icon"] = utility.getDeviceThumb(deviceType);
|
|
|
|
content["label"] = deviceTypeLabel;
|
|
|
|
content["label"] = deviceTypeLabel;
|
|
|
|
types["types"].push(content);
|
|
|
|
viewModelData["types"].push(content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return types;
|
|
|
|
|
|
|
|
|
|
|
|
var result = userModule.getRolesByUserStore();
|
|
|
|
|
|
|
|
if (result["status"] == "success") {
|
|
|
|
|
|
|
|
viewModelData["roles"] = result["content"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return viewModelData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|