Fix for EMM-1575

revert-70aa11f8
kamidu 8 years ago
parent 75df243a33
commit 0ab9db2afd

@ -103,12 +103,12 @@
<label class=" hidden error email-invalid" for="summary">Invalid Email <label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label> Address.</label>
</div> </div>
{{#if canViewRoles}}
<label class="wr-input-label" <label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user"> title="Optional field that can have 0-to-many roles for the user">
User Roles User Roles
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label> </label>
{{#if canViewRoles}}
<div class="wr-input-control"> <div class="wr-input-control">
<select id="roles" class="form-control select2" multiple="multiple"> <select id="roles" class="form-control select2" multiple="multiple">
{{#each roles}} {{#each roles}}

@ -179,6 +179,7 @@ $("#userStore").change(
$("select option:selected").each(function () { $("select option:selected").each(function () {
str += $(this).text() + ""; str += $(this).text() + "";
}); });
if ($("#roles").length > 0) {
var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + str + "&limit=100"; var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + str + "&limit=100";
invokerUtil.get( invokerUtil.get(
@ -200,6 +201,8 @@ $("#userStore").change(
} }
); );
}
}).change(); }).change();
$(document).ready(function () { $(document).ready(function () {
@ -224,7 +227,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val(); var firstname = firstnameInput.val();
var lastname = lastnameInput.val(); var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val(); var emailAddress = $("input#emailAddress").val();
var roles = $("select#roles").val(); var roles ;
if ($("#roles").length > 0) {
roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg"; var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span"; var errorMsg = "#user-create-error-msg span";
if (!username) { if (!username) {
@ -272,7 +278,9 @@ $(document).ready(function () {
$("input#firstname").val(""); $("input#firstname").val("");
$("input#lastname").val(""); $("input#lastname").val("");
$("input#email").val(""); $("input#email").val("");
if ($("#roles").length > 0) {
$("select#roles").select2("val", ""); $("select#roles").select2("val", "");
}
// Refreshing with success message // Refreshing with success message
$("#user-create-form").addClass("hidden"); $("#user-create-form").addClass("hidden");
$("#user-created-msg").removeClass("hidden"); $("#user-created-msg").removeClass("hidden");

@ -51,7 +51,8 @@
<div id="user-create-error-msg" class="alert alert-danger hidden" role="alert"> <div id="user-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span> <i class="icon fw fw-error"></i><span></span>
</div> </div>
<label class="wr-input-label" title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY"> <label class="wr-input-label"
title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY">
User Store Domain User Store Domain
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label> </label>
@ -94,8 +95,10 @@
<span class="glyphicon glyphicon-remove form-control-feedback hidden emailError"></span> <span class="glyphicon glyphicon-remove form-control-feedback hidden emailError"></span>
<label class=" hidden error email-required" for="summary">This field is <label class=" hidden error email-required" for="summary">This field is
required.</label> required.</label>
<label class=" hidden error email-invalid" for="summary">Invalid Email Address.</label> <label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label>
</div> </div>
{{#if canViewRoles}}
<label class="wr-input-label" <label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user"> title="Optional field that can have 0-to-many roles for the user">
User Roles User Roles
@ -109,6 +112,7 @@
{{/each}} {{/each}}
</select> </select>
</div> </div>
{{/if}}
</div> </div>
</div> </div>
<br> <br>

@ -63,6 +63,9 @@ function onRequest() {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true; page.canManage = true;
} }
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/view")) {
page.canViewRoles = true;
}
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"]; page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"]; page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];

@ -168,11 +168,16 @@ $(document).ready(function () {
$("select.select2[multiple=multiple]").select2({ $("select.select2[multiple=multiple]").select2({
tags: false tags: false
}); });
var roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, ""); var roleList, roleArr;
if ($("#roles").length > 0) {
roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, "");
roleList = roleList.replace(/(\r\n|\n|\r)/gm, ""); roleList = roleList.replace(/(\r\n|\n|\r)/gm, "");
var roleArr = roleList.split(","); roleArr = roleList.split(",");
$("#roles").val(roleArr).trigger("change"); }
if ($("#roles").length > 0) {
$("#roles").val(roleArr).trigger("change");
}
/** /**
* Following click function would execute * Following click function would execute
* when a user clicks on "Add User" button * when a user clicks on "Add User" button
@ -188,7 +193,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val(); var firstname = firstnameInput.val();
var lastname = lastnameInput.val(); var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val(); var emailAddress = $("input#emailAddress").val();
var roles;
if ($("#roles").length > 0) {
var roles = $("select#roles").val(); var roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg"; var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span"; var errorMsg = "#user-create-error-msg span";
if (!username) { if (!username) {

Loading…
Cancel
Save