mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
This commit is contained in:
commit
ce1f5c5701
@ -19,8 +19,8 @@
|
||||
/**
|
||||
* 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
|
||||
* @returns {*} A context object that returns 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 viewModel object that returns the dynamic state of this page to be presented
|
||||
*/
|
||||
function onRequest(context) {
|
||||
// var log = new Log("units/user-create/create.js");
|
||||
@ -29,17 +29,17 @@ function onRequest(context) {
|
||||
|
||||
var response = userModule.getRolesByUserStore();
|
||||
if (response["status"] == "success") {
|
||||
context["roles"] = response["content"];
|
||||
viewModel["roles"] = response["content"];
|
||||
}
|
||||
|
||||
context["charLimit"] = mdmProps["usernameLength"];
|
||||
context["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"];
|
||||
context["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"];
|
||||
context["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
||||
context["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"];
|
||||
context["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"];
|
||||
context["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"];
|
||||
context["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"];
|
||||
viewModel["charLimit"] = mdmProps["usernameLength"];
|
||||
viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"];
|
||||
viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"];
|
||||
viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
||||
viewModel["firstnameJSRegEx"] = mdmProps["userValidationConfig"]["firstnameJSRegEx"];
|
||||
viewModel["firstnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["firstnameRegExViolationErrorMsg"];
|
||||
viewModel["lastnameJSRegEx"] = mdmProps["userValidationConfig"]["lastnameJSRegEx"];
|
||||
viewModel["lastnameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["lastnameRegExViolationErrorMsg"];
|
||||
|
||||
return context;
|
||||
return viewModel;
|
||||
}
|
||||
@ -1,15 +1,16 @@
|
||||
function onRequest(context) {
|
||||
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
||||
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")) {
|
||||
context["removePermitted"] = true;
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/manage")) {
|
||||
viewModel["removePermitted"] = true;
|
||||
}
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/certificate/Get")) {
|
||||
context["viewPermitted"] = true;
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/certificates/view")) {
|
||||
viewModel["viewPermitted"] = true;
|
||||
}
|
||||
context["adminUser"] = mdmProps.adminUser;
|
||||
return context;
|
||||
|
||||
viewModel.adminUser = mdmProps.adminUser;
|
||||
return viewModel;
|
||||
}
|
||||
@ -40,7 +40,7 @@
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "navbarActions"}}
|
||||
{{#if permissions.ADD_ADMIN_POLICY}}
|
||||
{{#if managePermitted}}
|
||||
<li>
|
||||
<a href="{{@app.context}}/policy/add" class="cu-btn">
|
||||
<span class="icon fw-stack">
|
||||
@ -50,8 +50,6 @@
|
||||
Add Policy
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if permissions.CHANGE_POLICY_PRIORITY}}
|
||||
{{#equal noPolicy false}}
|
||||
<li>
|
||||
<a href="{{@app.context}}/policy/priority" class="cu-btn">
|
||||
@ -81,7 +79,7 @@
|
||||
<div class="ctrl-info-panel col-centered text-center wr-login">
|
||||
<h2>You don't have any policy at the moment.</h2>
|
||||
<br/>
|
||||
{{#if permissions.ADD_ADMIN_POLICY}}
|
||||
{{#if managePermitted}}
|
||||
<p class="text-center">
|
||||
<a href="{{@app.context}}/policy/add" class="wr-btn">
|
||||
<span class="fw-stack">
|
||||
@ -142,7 +140,7 @@
|
||||
<tr class="bulk-action-row">
|
||||
<th colspan="9">
|
||||
<ul class="tiles">
|
||||
{{#if removePermitted}}
|
||||
{{#if managePermitted}}
|
||||
<li class="square">
|
||||
<a href="#" data-click-event="remove-form"
|
||||
class="btn square-element policy-remove-link"
|
||||
|
||||
@ -57,14 +57,7 @@ function onRequest(context) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "content"}}
|
||||
{{#if canManage}}
|
||||
<!-- content/body -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@ -140,6 +141,14 @@
|
||||
<!-- /content -->
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<h1 class="page-sub-title">
|
||||
Permission Denied
|
||||
</h1>
|
||||
<br>
|
||||
You not authorized to enter User Management Section.
|
||||
<br>
|
||||
{{/if}}
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
|
||||
@ -32,6 +32,9 @@ function onRequest() {
|
||||
page["roles"] = response["content"];
|
||||
}
|
||||
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
|
||||
page.canManage = true;
|
||||
}
|
||||
var userStores = userModule.getSecondaryUserStores();
|
||||
page["userStores"] = userStores;
|
||||
page["charLimit"] = devicemgtProps["usernameLength"];
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "content"}}
|
||||
|
||||
{{#if canManage}}
|
||||
<!-- content/body -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@ -137,6 +137,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- /content/body -->
|
||||
{{else}}
|
||||
<h1 class="page-sub-title">
|
||||
Permission Denied
|
||||
</h1>
|
||||
<br>
|
||||
You not authorized to enter User Management Section.
|
||||
<br>
|
||||
{{/if}}
|
||||
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
|
||||
@ -60,6 +60,10 @@ function onRequest() {
|
||||
page["rolesByUserStore"] = rolesByUserStore;
|
||||
}
|
||||
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
|
||||
page.canManage = true;
|
||||
}
|
||||
|
||||
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
|
||||
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
||||
page["firstnameJSRegEx"] = devicemgtProps["userValidationConfig"]["firstnameJSRegEx"];
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "content"}}
|
||||
{{#if canView}}}
|
||||
{{#zone "contentTitle"}}
|
||||
<div class="row wr-device-board">
|
||||
<div class="col-lg-12 wr-secondary-bar">
|
||||
@ -166,4 +167,12 @@
|
||||
{{/defineZone}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<h1 class="page-sub-title">
|
||||
Permission Denied
|
||||
</h1>
|
||||
<br>
|
||||
You not authorized to enter User Management Section.
|
||||
<br>
|
||||
{{/if}}
|
||||
{{/zone}}
|
||||
|
||||
@ -40,5 +40,10 @@ function onRequest(context) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
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 -->
|
||||
<div id="loading-content" class="col-centered">
|
||||
{{#if removePermitted}}
|
||||
{{#if canManage}}
|
||||
<input type="hidden" id="can-remove" value="true"/>
|
||||
{{/if}}
|
||||
{{#if editPermitted}}
|
||||
<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"/>
|
||||
{{/if}}
|
||||
{{#if resetPasswordPermitted}}
|
||||
<input type="hidden" id="can-reset-password" value="true"/>
|
||||
{{/if}}
|
||||
{{#if canView}}
|
||||
<input type="hidden" id="can-view" value="true"/>
|
||||
{{/if}}
|
||||
|
||||
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||
Loading users . . .
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<tr class="sort-row">
|
||||
<th>By Username</th>
|
||||
@ -105,7 +101,8 @@
|
||||
|
||||
<div id="invite-user-modal-content" class="hide">
|
||||
<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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -145,7 +142,8 @@
|
||||
</span>
|
||||
Unexpected Error
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -164,7 +162,8 @@
|
||||
<h3 class="pull-left modal-title">
|
||||
Remove User
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -184,7 +183,8 @@
|
||||
<h3 class="pull-left modal-title">
|
||||
User Removed.
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -207,7 +207,8 @@
|
||||
</span>
|
||||
Unexpected Error
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -230,7 +231,8 @@
|
||||
</span>
|
||||
Operation cannot be performed !
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<h4>
|
||||
@ -249,7 +251,8 @@
|
||||
<h3 class="pull-left modal-title">
|
||||
Unauthorized action!
|
||||
</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>
|
||||
|
||||
@ -263,7 +266,8 @@
|
||||
</span>
|
||||
Reset Password
|
||||
</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 class="modal-body add-margin-top-2x add-margin-bottom-2x">
|
||||
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
|
||||
@ -273,13 +277,15 @@
|
||||
Enter new password
|
||||
<br><br>
|
||||
<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>
|
||||
<br>
|
||||
Retype new password
|
||||
<br><br>
|
||||
<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>
|
||||
<br>
|
||||
</h4>
|
||||
@ -287,11 +293,11 @@
|
||||
<div class="modal-footer">
|
||||
<div class="buttons">
|
||||
<a href="#" id="reset-password-yes-link" class="btn-operations">
|
||||
Save
|
||||
Save
|
||||
</a>
|
||||
|
||||
|
||||
<a href="#" id="reset-password-cancel-link" class="btn-operations">
|
||||
Cancel
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -302,12 +308,13 @@
|
||||
<h3 class="pull-left modal-title">
|
||||
Password reset is successful.
|
||||
</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 class="modal-footer">
|
||||
<div class="buttons">
|
||||
<a href="#" id="reset-password-success-link" class="btn-operations">
|
||||
Ok
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -32,24 +32,15 @@ function onRequest(context) {
|
||||
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
|
||||
page["adminUser"] = deviceMgtProps["adminUser"];
|
||||
page["permissions"] = userModule.getUIPermissions();
|
||||
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/remove")) {
|
||||
page["removePermitted"] = true;
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
|
||||
page.canManage = true;
|
||||
}
|
||||
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/update")) {
|
||||
page["editPermitted"] = true;
|
||||
}
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
|
||||
page["viewPermitted"] = 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;
|
||||
page.canView = true;
|
||||
}
|
||||
|
||||
|
||||
return page;
|
||||
}
|
||||
@ -108,12 +108,13 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
|
||||
.draw();
|
||||
|
||||
if (filterColumn.eq(column.index()).hasClass('data-platform')) {
|
||||
if (val == null || val == undefined || val == "") {
|
||||
$("#operation-bar").hide();
|
||||
$("#operation-guide").show();
|
||||
if (!val) {
|
||||
$("#operation-bar").addClass("hidden");
|
||||
$("#operation-guide").removeClass("hidden");
|
||||
} else {
|
||||
$("#operation-guide").hide();
|
||||
$("#operation-bar").show();
|
||||
$("#operation-guide").addClass("hidden");
|
||||
$("#operation-bar").removeClass("hidden");
|
||||
//noinspection JSUnresolvedFunction
|
||||
loadOperationBar(val);
|
||||
}
|
||||
}
|
||||
@ -141,13 +142,9 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
|
||||
var title = filterColumn.eq(column.index()).attr('data-for');
|
||||
$(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 () {
|
||||
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)
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
@ -21,7 +21,7 @@ function onRequest(context) {
|
||||
var constants = require("/app/modules/constants.js");
|
||||
var viewModel = {};
|
||||
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");
|
||||
}
|
||||
var currentUser = session.get(constants.USER_SESSION_KEY);
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
under the License.
|
||||
}}
|
||||
{{#zone "content"}}
|
||||
{{#if isAuthorized}}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- content -->
|
||||
@ -117,6 +118,14 @@
|
||||
<!-- /content -->
|
||||
</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 "bottomJs"}}
|
||||
{{js "js/platform-configuration.js"}}
|
||||
|
||||
@ -20,6 +20,10 @@ function onRequest(context) {
|
||||
var utility = require("/app/modules/utility.js").utility;
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
//get all device types
|
||||
var isAuthorized = false;
|
||||
if (userModule.isAuthorized("/permission/admin/device-mgt/notifications/view")) {
|
||||
isAuthorized = true;
|
||||
}
|
||||
var deviceTypesArray = [];
|
||||
var typesListResponse = deviceModule.getDeviceTypes();
|
||||
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;
|
||||
/*margin-left:17px;*/
|
||||
margin-bottom:15px;
|
||||
border-bottom:1px solid #f0f0f0;
|
||||
/*border-bottom:1px solid #f0f0f0;*/
|
||||
}
|
||||
|
||||
.wr-operations a {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user