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