|
|
@ -69,24 +69,12 @@ function hidePopup() {
|
|
|
|
$(modalPopup).hide();
|
|
|
|
$(modalPopup).hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Function to get selected usernames.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function getSelectedUsernames() {
|
|
|
|
|
|
|
|
var usernameList = [];
|
|
|
|
|
|
|
|
var userList = $("#user-grid").find('tr.DTTT_selected');
|
|
|
|
|
|
|
|
userList.each(function () {
|
|
|
|
|
|
|
|
usernameList.push($(this).data('username'));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return usernameList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Following click function would execute
|
|
|
|
* Following click function would execute
|
|
|
|
* when a user clicks on "Invite" link
|
|
|
|
* when a user clicks on "Invite" link
|
|
|
|
* on User Management page in WSO2 MDM Console.
|
|
|
|
* on User Management page in WSO2 MDM Console.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
$("a.invite-user-link").click(function () {
|
|
|
|
$("a#invite-user-link").click(function () {
|
|
|
|
var usernameList = getSelectedUsernames();
|
|
|
|
var usernameList = getSelectedUsernames();
|
|
|
|
var inviteUserAPI = apiBasePath + "/users/send-invitation";
|
|
|
|
var inviteUserAPI = apiBasePath + "/users/send-invitation";
|
|
|
|
|
|
|
|
|
|
|
@ -122,42 +110,16 @@ $("a.invite-user-link").click(function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/*
|
|
|
|
* Following click function would execute
|
|
|
|
* Function to get selected usernames.
|
|
|
|
* when a user clicks on "Remove" link
|
|
|
|
|
|
|
|
* on User Listing page in WSO2 MDM Console.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function removeUser(uname) {
|
|
|
|
function getSelectedUsernames() {
|
|
|
|
var username = uname;
|
|
|
|
var usernameList = [];
|
|
|
|
var removeUserAPI = apiBasePath + "/users/" + username;
|
|
|
|
var userList = $("#user-grid").find("tr.DTTT_selected");
|
|
|
|
$(modalPopupContent).html($('#remove-user-modal-content').html());
|
|
|
|
userList.each(function () {
|
|
|
|
showPopup();
|
|
|
|
usernameList.push($(this).data('username'));
|
|
|
|
|
|
|
|
|
|
|
|
$("a#remove-user-yes-link").click(function () {
|
|
|
|
|
|
|
|
invokerUtil.delete(
|
|
|
|
|
|
|
|
removeUserAPI,
|
|
|
|
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
|
|
|
|
$("#user-" + username).remove();
|
|
|
|
|
|
|
|
// update modal-content with success message
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-success-content').html());
|
|
|
|
|
|
|
|
$("a#remove-user-success-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
function () {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-error-content').html());
|
|
|
|
|
|
|
|
$("a#remove-user-error-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("a#remove-user-cancel-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return usernameList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -165,15 +127,13 @@ function removeUser(uname) {
|
|
|
|
* when a user clicks on "Reset Password" link
|
|
|
|
* when a user clicks on "Reset Password" link
|
|
|
|
* on User Listing page in WSO2 MDM Console.
|
|
|
|
* on User Listing page in WSO2 MDM Console.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function resetPassword(uname) {
|
|
|
|
function resetPassword(username) {
|
|
|
|
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#reset-password-window').html());
|
|
|
|
$(modalPopupContent).html($('#reset-password-window').html());
|
|
|
|
showPopup();
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
|
|
|
|
$("a#reset-password-yes-link").click(function () {
|
|
|
|
$("a#reset-password-yes-link").click(function () {
|
|
|
|
var newPassword = $("#new-password").val();
|
|
|
|
var newPassword = $("#new-password").val();
|
|
|
|
var confirmedPassword = $("#confirmed-password").val();
|
|
|
|
var confirmedPassword = $("#confirmed-password").val();
|
|
|
|
var user = uname;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var errorMsgWrapper = "#notification-error-msg";
|
|
|
|
var errorMsgWrapper = "#notification-error-msg";
|
|
|
|
var errorMsg = "#notification-error-msg span";
|
|
|
|
var errorMsg = "#notification-error-msg span";
|
|
|
@ -191,10 +151,9 @@ function resetPassword(uname) {
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var resetPasswordFormData = {};
|
|
|
|
var resetPasswordFormData = {};
|
|
|
|
//resetPasswordFormData.username = user;
|
|
|
|
|
|
|
|
resetPasswordFormData.newPassword = unescape(confirmedPassword);
|
|
|
|
resetPasswordFormData.newPassword = unescape(confirmedPassword);
|
|
|
|
|
|
|
|
|
|
|
|
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ user +"/credentials";
|
|
|
|
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ username +"/credentials";
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.post(
|
|
|
|
invokerUtil.post(
|
|
|
|
resetPasswordServiceURL,
|
|
|
|
resetPasswordServiceURL,
|
|
|
@ -223,6 +182,43 @@ function resetPassword(uname) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Following click function would execute
|
|
|
|
|
|
|
|
* when a user clicks on "Remove" link
|
|
|
|
|
|
|
|
* on User Listing page in WSO2 MDM Console.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function removeUser(username) {
|
|
|
|
|
|
|
|
var removeUserAPI = apiBasePath + "/users/" + username;
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-modal-content').html());
|
|
|
|
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("a#remove-user-yes-link").click(function () {
|
|
|
|
|
|
|
|
invokerUtil.delete(
|
|
|
|
|
|
|
|
removeUserAPI,
|
|
|
|
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
|
|
|
|
$("#user-" + username).remove();
|
|
|
|
|
|
|
|
// update modal-content with success message
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-success-content').html());
|
|
|
|
|
|
|
|
$("a#remove-user-success-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
function () {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-error-content').html());
|
|
|
|
|
|
|
|
$("a#remove-user-error-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("a#remove-user-cancel-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Following function would execute
|
|
|
|
* Following function would execute
|
|
|
|
* when a user clicks on the list item
|
|
|
|
* when a user clicks on the list item
|
|
|
|