mharindu 8 years ago
commit ce1f5c5701

@ -19,8 +19,8 @@
/** /**
* Returns the dynamic state to be populated by add-user page. * Returns the dynamic state to be populated by add-user page.
* *
* @param context Object that gets updated with the dynamic state of this page to be presented * @param viewModel Object that gets updated with the dynamic state of this page to be presented
* @returns {*} A context object that returns the dynamic state of this page to be presented * @returns {*} A viewModel object that returns the dynamic state of this page to be presented
*/ */
function onRequest(context) { function onRequest(context) {
// var log = new Log("units/user-create/create.js"); // var log = new Log("units/user-create/create.js");
@ -29,17 +29,17 @@ function onRequest(context) {
var response = userModule.getRolesByUserStore(); var response = userModule.getRolesByUserStore();
if (response["status"] == "success") { if (response["status"] == "success") {
context["roles"] = response["content"]; viewModel["roles"] = response["content"];
} }
context["charLimit"] = mdmProps["usernameLength"]; viewModel["charLimit"] = mdmProps["usernameLength"];
context["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"]; viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"];
context["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"]; viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"];
context["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
context["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"]; viewModel["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"];
context["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"]; viewModel["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"];
context["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"]; viewModel["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"];
context["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"]; viewModel["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"];
return context; return viewModel;
} }

@ -1,15 +1,16 @@
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var viewModel = {};
context["permissions"] = userModule.getUIPermissions();
if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/certificate/Get")) { if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/manage")) {
context["removePermitted"] = true; viewModel["removePermitted"] = true;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/certificate/Get")) { if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/view")) {
context["viewPermitted"] = true; viewModel["viewPermitted"] = true;
} }
context["adminUser"] = mdmProps.adminUser;
return context; viewModel.adminUser = mdmProps.adminUser;
return viewModel;
} }

@ -40,7 +40,7 @@
{{/zone}} {{/zone}}
{{#zone "navbarActions"}} {{#zone "navbarActions"}}
{{#if permissions.ADD_ADMIN_POLICY}} {{#if managePermitted}}
<li> <li>
<a href="{{@app.context}}/policy/add" class="cu-btn"> <a href="{{@app.context}}/policy/add" class="cu-btn">
<span class="icon fw-stack"> <span class="icon fw-stack">
@ -50,8 +50,6 @@
Add Policy Add Policy
</a> </a>
</li> </li>
{{/if}}
{{#if permissions.CHANGE_POLICY_PRIORITY}}
{{#equal noPolicy false}} {{#equal noPolicy false}}
<li> <li>
<a href="{{@app.context}}/policy/priority" class="cu-btn"> <a href="{{@app.context}}/policy/priority" class="cu-btn">
@ -81,7 +79,7 @@
<div class="ctrl-info-panel col-centered text-center wr-login"> <div class="ctrl-info-panel col-centered text-center wr-login">
<h2>You don't have any policy at the moment.</h2> <h2>You don't have any policy at the moment.</h2>
<br/> <br/>
{{#if permissions.ADD_ADMIN_POLICY}} {{#if managePermitted}}
<p class="text-center"> <p class="text-center">
<a href="{{@app.context}}/policy/add" class="wr-btn"> <a href="{{@app.context}}/policy/add" class="wr-btn">
<span class="fw-stack"> <span class="fw-stack">
@ -142,7 +140,7 @@
<tr class="bulk-action-row"> <tr class="bulk-action-row">
<th colspan="9"> <th colspan="9">
<ul class="tiles"> <ul class="tiles">
{{#if removePermitted}} {{#if managePermitted}}
<li class="square"> <li class="square">
<a href="#" data-click-event="remove-form" <a href="#" data-click-event="remove-form"
class="btn square-element policy-remove-link" class="btn square-element policy-remove-link"

@ -57,14 +57,7 @@ function onRequest(context) {
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) { if (userModule.isAuthorized("/permission/admin/device-mgt/policies/delete")) {
page["removePermitted"] = true; page.managePermitted = true;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/policies/remove")) {
page["removePermitted"] = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/policies/update")) {
page["editPermitted"] = true;
}
page.permissions = userModule.getUIPermissions();
return page; return page;
} }

@ -36,6 +36,7 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{#if canManage}}
<!-- content/body --> <!-- content/body -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -140,6 +141,14 @@
<!-- /content --> <!-- /content -->
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter User Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -32,6 +32,9 @@ function onRequest() {
page["roles"] = response["content"]; page["roles"] = response["content"];
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true;
}
var userStores = userModule.getSecondaryUserStores(); var userStores = userModule.getSecondaryUserStores();
page["userStores"] = userStores; page["userStores"] = userStores;
page["charLimit"] = devicemgtProps["usernameLength"]; page["charLimit"] = devicemgtProps["usernameLength"];

@ -36,7 +36,7 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{#if canManage}}
<!-- content/body --> <!-- content/body -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -137,6 +137,15 @@
</div> </div>
</div> </div>
<!-- /content/body --> <!-- /content/body -->
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter User Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -60,6 +60,10 @@ function onRequest() {
page["rolesByUserStore"] = rolesByUserStore; page["rolesByUserStore"] = rolesByUserStore;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true;
}
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"]; page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
page["firstnameJSRegEx"] = devicemgtProps["userValidationConfig"]["firstnameJSRegEx"]; page["firstnameJSRegEx"] = devicemgtProps["userValidationConfig"]["firstnameJSRegEx"];

@ -36,6 +36,7 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{#if canView}}}
{{#zone "contentTitle"}} {{#zone "contentTitle"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
@ -166,4 +167,12 @@
{{/defineZone}} {{/defineZone}}
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter User Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}

@ -40,5 +40,10 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
devices = deviceModule.getDevices(userName); devices = deviceModule.getDevices(userName);
} }
return {"user": user, "userRoles": userRoles, "devices": devices};
var canView = false;
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
canView = true;
}
return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView};
} }

@ -50,28 +50,24 @@
<!-- content --> <!-- content -->
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
{{#if removePermitted}} {{#if canManage}}
<input type="hidden" id="can-remove" value="true"/> <input type="hidden" id="can-remove" value="true"/>
{{/if}}
{{#if editPermitted}}
<input type="hidden" id="can-edit" value="true"/> <input type="hidden" id="can-edit" value="true"/>
{{/if}}
{{#if viewPermitted}}
<input type="hidden" id="can-view" value="true"/>
{{/if}}
{{#if invitePermitted}}
<input type="hidden" id="can-invite" value="true"/> <input type="hidden" id="can-invite" value="true"/>
{{/if}}
{{#if resetPasswordPermitted}}
<input type="hidden" id="can-reset-password" value="true"/> <input type="hidden" id="can-reset-password" value="true"/>
{{/if}} {{/if}}
{{#if canView}}
<input type="hidden" id="can-view" value="true"/>
{{/if}}
<i class="fw fw-settings fw-spin fw-2x"></i> <i class="fw fw-settings fw-spin fw-2x"></i>
Loading users . . . Loading users . . .
<br> <br>
</div> </div>
<div id="user-table" data-user={{adminUser}}> <div id="user-table" data-user={{adminUser}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="user-grid"> <table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"
id="user-grid">
<thead> <thead>
<tr class="sort-row"> <tr class="sort-row">
<th>By Username</th> <th>By Username</th>
@ -105,7 +101,8 @@
<div id="invite-user-modal-content" class="hide"> <div id="invite-user-modal-content" class="hide">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -145,7 +142,8 @@
</span> </span>
Unexpected Error Unexpected Error
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -164,7 +162,8 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Remove User Remove User
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -184,7 +183,8 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
User Removed. User Removed.
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -207,7 +207,8 @@
</span> </span>
Unexpected Error Unexpected Error
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -230,7 +231,8 @@
</span> </span>
Operation cannot be performed ! Operation cannot be performed !
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
@ -249,7 +251,8 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Unauthorized action! Unauthorized action!
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
</div> </div>
@ -263,7 +266,8 @@
</span> </span>
Reset Password Reset Password
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert"> <div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
@ -273,13 +277,15 @@
Enter new password Enter new password
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="new-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="new-password"
data-key="message"/>
</div> </div>
<br> <br>
Retype new password Retype new password
<br><br> <br><br>
<div> <div>
<input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password" data-key="message"/> <input type="password" class="form-control modal-input operationDataKeys" id="confirmed-password"
data-key="message"/>
</div> </div>
<br> <br>
</h4> </h4>
@ -287,11 +293,11 @@
<div class="modal-footer"> <div class="modal-footer">
<div class="buttons"> <div class="buttons">
<a href="#" id="reset-password-yes-link" class="btn-operations"> <a href="#" id="reset-password-yes-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp; Save
</a> </a>
&nbsp;&nbsp;
<a href="#" id="reset-password-cancel-link" class="btn-operations"> <a href="#" id="reset-password-cancel-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp; Cancel
</a> </a>
</div> </div>
</div> </div>
@ -302,12 +308,13 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Password reset is successful. Password reset is successful.
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="buttons"> <div class="buttons">
<a href="#" id="reset-password-success-link" class="btn-operations"> <a href="#" id="reset-password-success-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp; Ok
</a> </a>
</div> </div>
</div> </div>

@ -32,24 +32,15 @@ function onRequest(context) {
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
page["adminUser"] = deviceMgtProps["adminUser"]; page["adminUser"] = deviceMgtProps["adminUser"];
page["permissions"] = userModule.getUIPermissions();
if (userModule.isAuthorized("/permission/admin/device-mgt/users/remove")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page["removePermitted"] = true; page.canManage = true;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/users/update")) {
page["editPermitted"] = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
page["viewPermitted"] = true; page.canView = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/users/invite")) {
page["invitePermitted"] = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/users/reset-password")) {
page["resetPasswordPermitted"] = true;
} }
return page; return page;
} }

@ -108,12 +108,13 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
.draw(); .draw();
if (filterColumn.eq(column.index()).hasClass('data-platform')) { if (filterColumn.eq(column.index()).hasClass('data-platform')) {
if (val == null || val == undefined || val == "") { if (!val) {
$("#operation-bar").hide(); $("#operation-bar").addClass("hidden");
$("#operation-guide").show(); $("#operation-guide").removeClass("hidden");
} else { } else {
$("#operation-guide").hide(); $("#operation-guide").addClass("hidden");
$("#operation-bar").show(); $("#operation-bar").removeClass("hidden");
//noinspection JSUnresolvedFunction
loadOperationBar(val); loadOperationBar(val);
} }
} }
@ -141,13 +142,9 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
var title = filterColumn.eq(column.index()).attr('data-for'); var title = filterColumn.eq(column.index()).attr('data-for');
$(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" placeholder="Search ' + title + '" />'); $(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" placeholder="Search ' + title + '" />');
//noinspection SpellCheckingInspection
filterColumn.eq(column.index()).find('input').on('keyup change', function () { filterColumn.eq(column.index()).find('input').on('keyup change', function () {
column.search($(this).val()).draw(); column.search($(this).val()).draw();
if ($('.dataTables_empty').length > 0) {
$('.bulk-action-row').addClass("hidden");
} else {
$('.bulk-action-row').removeClass("hidden");
}
}); });
} }
@ -285,5 +282,4 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
} }
},settings) },settings)
); );
}; };

@ -21,7 +21,7 @@ function onRequest(context) {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var viewModel = {}; var viewModel = {};
var permissions = []; var permissions = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/notifications/list")) { if (userModule.isAuthorized("/permission/admin/device-mgt/notifications/view")) {
permissions.push("LIST_NOTIFICATIONS"); permissions.push("LIST_NOTIFICATIONS");
} }
var currentUser = session.get(constants.USER_SESSION_KEY); var currentUser = session.get(constants.USER_SESSION_KEY);

@ -16,6 +16,7 @@
under the License. under the License.
}} }}
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<!-- content --> <!-- content -->
@ -117,6 +118,14 @@
<!-- /content --> <!-- /content -->
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter General and Platform Specific Server Setting Management Section.
<br>
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/platform-configuration.js"}} {{js "js/platform-configuration.js"}}

@ -20,6 +20,10 @@ function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
//get all device types //get all device types
var isAuthorized = false;
if (userModule.isAuthorized("/permission/admin/device-mgt/notifications/view")) {
isAuthorized = true;
}
var deviceTypesArray = []; var deviceTypesArray = [];
var typesListResponse = deviceModule.getDeviceTypes(); var typesListResponse = deviceModule.getDeviceTypes();
if (typesListResponse["status"] == "success") { if (typesListResponse["status"] == "success") {
@ -43,5 +47,8 @@ function onRequest(context) {
} }
} }
} }
return {"deviceTypes" : deviceTypesArray}; return {
"deviceTypes": deviceTypesArray,
"isAuthorized": isAuthorized
};
} }

@ -3193,7 +3193,7 @@ a.ast-type-item:hover {
clear:both; clear:both;
/*margin-left:17px;*/ /*margin-left:17px;*/
margin-bottom:15px; margin-bottom:15px;
border-bottom:1px solid #f0f0f0; /*border-bottom:1px solid #f0f0f0;*/
} }
.wr-operations a { .wr-operations a {

Loading…
Cancel
Save