Merge pull request #483 from rasika/release-3.0.x

Adding UI permissions on Android Operations
revert-dabc3590
Ruwan 8 years ago committed by GitHub
commit 771372a890

@ -15,7 +15,7 @@
specific language governing permissions and limitations
under the License.
}}
{{#if control_operations}}
{{#if controlOperations}}
<div class="wr-operations" style="height: 87px; display: block;"
xmlns="http://www.w3.org/1999/html">
<style>
@ -35,7 +35,7 @@
color: #B8B8B8;
}
</style>
{{#each control_operations}}
{{#each controlOperations}}
<a href="javascript:operationSelect('{{operation}}')">
{{#if iconFont}}
<i class="fw {{iconFont}}"></i>

@ -19,28 +19,37 @@
function onRequest(context) {
var log = new Log("operation.js");
var operationModule = require("/app/modules/business-controllers/operation.js")["operationModule"];
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var device = context.unit.params.device;
var autoCompleteParams = context.unit.params.autoCompleteParams;
var encodedFeaturePayloads = context.unit.params.encodedFeaturePayloads;
var controlOperations = operationModule.getControlOperations(device.type);
var allControlOps = operationModule.getControlOperations(device.type);
var filteredControlOps = [];
var queryParams = [];
var formParams = [];
var pathParams = [];
for (var i = 0; i < controlOperations.length; i++) {
var currentParamList = controlOperations[i]["params"];
var uiParamList = controlOperations[i]["uiParams"];
for (var i = 0; i < allControlOps.length; i++) {
var controlOperation = {};
var uiPermission = allControlOps[i]["uiPermission"];
if (uiPermission && !userModule.isAuthorized("/permission/admin/" + uiPermission)) {
continue;
}
controlOperation = allControlOps[i];
var currentParamList = allControlOps[i]["params"];
for (var j = 0; j < currentParamList.length; j++) {
var currentParam = currentParamList[j];
currentParamList[j]["formParams"] = processParams(currentParam["formParams"], autoCompleteParams);
currentParamList[j]["queryParams"] = processParams(currentParam["queryParams"], autoCompleteParams);
currentParamList[j]["pathParams"] = processParams(currentParam["pathParams"], autoCompleteParams);
}
controlOperations[i]["uiParams"] = uiParamList;
controlOperation["params"] = currentParamList;
if (encodedFeaturePayloads) {
controlOperations[i]["payload"] = getPayload(encodedFeaturePayloads, controlOperations[i]["operation"]);
allControlOps[i]["payload"] = getPayload(encodedFeaturePayloads, allControlOps[i]["operation"]);
}
filteredControlOps.push(controlOperation);
}
return {"control_operations": controlOperations, "device": device};
return {"controlOperations": filteredControlOps, "device": device};
}
function processParams(paramsList, autoCompleteParams) {

@ -6,7 +6,8 @@
"groupingEnabled": "false",
"features": {
"DEVICE_RING": {
"icon": "fw-dial-up"
"icon": "fw-dial-up",
"permission": "/device-mgt/devices/owning-device/operations/android/ring"
},
"DEVICE_LOCK": {
"icon": "fw-lock",
@ -22,16 +23,20 @@
"optional": true,
"label": "Hard lock enabled"
}
]
],
"permission": "/device-mgt/devices/owning-device/operations/android/lock"
},
"DEVICE_LOCATION": {
"icon": "fw-map-location"
"icon": "fw-map-location",
"permission": "/device-mgt/devices/owning-device/operations/android/location"
},
"CLEAR_PASSWORD": {
"icon": "fw-clear"
"icon": "fw-clear",
"permission": "/device-mgt/devices/owning-device/operations/android/clear-password"
},
"DEVICE_REBOOT": {
"icon": "fw-refresh"
"icon": "fw-refresh",
"permission": "/device-mgt/devices/owning-device/operations/android/reboot"
},
"UPGRADE_FIRMWARE": {
"icon": "fw-hardware",
@ -55,10 +60,12 @@
"optional": true,
"label": "Enter firmware upgrade server URL (ie. http://abc.com or http://abc.com/ota)"
}
]
],
"permission": "/device-mgt/devices/owning-device/operations/android/upgrade"
},
"DEVICE_MUTE": {
"icon": "fw-mute"
"icon": "fw-mute",
"permission": "/device-mgt/devices/owning-device/operations/android/mute"
},
"NOTIFICATION": {
"icon": "fw-message",
@ -75,7 +82,8 @@
"optional": false,
"label": "Message Here..."
}
]
],
"permission": "/device-mgt/devices/owning-device/operations/android/send-notification"
},
"CHANGE_LOCK_CODE": {
"icon": "fw-security",
@ -86,10 +94,12 @@
"optional": false,
"label": "Lock Code"
}
]
],
"permission": "/device-mgt/devices/owning-device/operations/android/change-lock-code"
},
"ENTERPRISE_WIPE": {
"icon": "fw-block"
"icon": "fw-block",
"permission": "/device-mgt/devices/owning-device/operations/android/enterprise-wipe"
},
"WIPE_DATA": {
"icon": "fw-delete",
@ -100,7 +110,8 @@
"optional": false,
"label": "Enter PIN code* of the device."
}
]
],
"permission": "/device-mgt/devices/owning-device/operations/android/wipe"
}
}
}

Loading…
Cancel
Save