|
|
@ -1,54 +1,37 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
|
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
|
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
|
|
* Version 2.0 (the "License"); you may not use this file except
|
|
|
|
* Version 2.0 (the "License"); you may not use this file except
|
|
|
|
* in compliance with the License.
|
|
|
|
* in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* either express or implied. See the License for the
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
var deviceMgtAPIsBasePath = "/api/device-mgt/v1.0";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Checks if provided input is valid against RegEx input.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param regExp Regular expression
|
|
|
|
|
|
|
|
* @param inputString Input string to check
|
|
|
|
|
|
|
|
* @returns {boolean} Returns true if input matches RegEx
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function inputIsValid(regExp, inputString) {
|
|
|
|
|
|
|
|
regExp = new RegExp(regExp);
|
|
|
|
|
|
|
|
return regExp.test(inputString);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Sorting function of users
|
|
|
|
|
|
|
|
* listed on User Management page in WSO2 Devicemgt Console.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
|
|
|
var sortableElem = '.wr-sortable';
|
|
|
|
var sortableElem = '.wr-sortable';
|
|
|
|
$(sortableElem).sortable({
|
|
|
|
$(sortableElem).sortable({
|
|
|
|
beforeStop: function () {
|
|
|
|
beforeStop: function () {
|
|
|
|
$(this).sortable('toArray');
|
|
|
|
var sortedIDs = $(this).sortable('toArray');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(sortableElem).disableSelection();
|
|
|
|
$(sortableElem).disableSelection();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var apiBasePath = "/api/device-mgt/v1.0";
|
|
|
|
var modalPopup = ".wr-modalpopup";
|
|
|
|
var modalPopup = ".wr-modalpopup";
|
|
|
|
var modalPopupContainer = modalPopup + " .modalpopup-container";
|
|
|
|
var modalPopupContainer = modalPopup + " .modalpopup-container";
|
|
|
|
var modalPopupContent = modalPopup + " .modalpopup-content";
|
|
|
|
var modalPopupContent = modalPopup + " .modalpopup-content";
|
|
|
|
var body = "body";
|
|
|
|
var body = "body";
|
|
|
|
//var isInit = true;
|
|
|
|
var isInit = true;
|
|
|
|
$(".icon .text").res_text(0.2);
|
|
|
|
$(".icon .text").res_text(0.2);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -90,11 +73,11 @@ function getSelectedUsernames() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 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 Devicemgt 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 = deviceMgtAPIsBasePath + "/users/send-invitation";
|
|
|
|
var inviteUserAPI = apiBasePath + "/users/send-invitation";
|
|
|
|
|
|
|
|
|
|
|
|
if (usernameList.length == 0) {
|
|
|
|
if (usernameList.length == 0) {
|
|
|
|
$(modalPopupContent).html($("#errorUsers").html());
|
|
|
|
$(modalPopupContent).html($("#errorUsers").html());
|
|
|
@ -108,18 +91,13 @@ $("a.invite-user-link").click(function () {
|
|
|
|
invokerUtil.post(
|
|
|
|
invokerUtil.post(
|
|
|
|
inviteUserAPI,
|
|
|
|
inviteUserAPI,
|
|
|
|
usernameList,
|
|
|
|
usernameList,
|
|
|
|
// success callback
|
|
|
|
function () {
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
$(modalPopupContent).html($('#invite-user-success-content').html());
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
$("a#invite-user-success-link").click(function () {
|
|
|
|
$(modalPopupContent).html($('#invite-user-success-content').html());
|
|
|
|
hidePopup();
|
|
|
|
$("a#invite-user-success-link").click(function () {
|
|
|
|
});
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// error callback
|
|
|
|
function () {
|
|
|
|
function (jqXHR) {
|
|
|
|
|
|
|
|
console.log("error in invite-user API, status code: " + jqXHR.status);
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#invite-user-error-content').html());
|
|
|
|
$(modalPopupContent).html($('#invite-user-error-content').html());
|
|
|
|
$("a#invite-user-error-link").click(function () {
|
|
|
|
$("a#invite-user-error-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
@ -136,30 +114,31 @@ $("a.invite-user-link").click(function () {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Following click function would execute
|
|
|
|
* Following click function would execute
|
|
|
|
* when a user clicks on "Remove" link
|
|
|
|
* when a user clicks on "Remove" link
|
|
|
|
* on User Listing page in WSO2 Devicemgt Console.
|
|
|
|
* on User Listing page in WSO2 MDM Console.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function removeUser(username) {
|
|
|
|
function removeUser(uname, uid) {
|
|
|
|
var removeUserAPI = deviceMgtAPIsBasePath + "/users/" + username;
|
|
|
|
var username = uname;
|
|
|
|
|
|
|
|
var userid = uid;
|
|
|
|
|
|
|
|
var removeUserAPI = apiBasePath + "/users/" + username;
|
|
|
|
$(modalPopupContent).html($('#remove-user-modal-content').html());
|
|
|
|
$(modalPopupContent).html($('#remove-user-modal-content').html());
|
|
|
|
showPopup();
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
|
|
|
|
$("a#remove-user-yes-link").click(function () {
|
|
|
|
$("a#remove-user-yes-link").click(function () {
|
|
|
|
invokerUtil.delete(
|
|
|
|
invokerUtil.delete(
|
|
|
|
removeUserAPI,
|
|
|
|
removeUserAPI,
|
|
|
|
// success callback
|
|
|
|
function () {
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
$("#" + userid).remove();
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
// get new user-list-count
|
|
|
|
// update modal-content with success message
|
|
|
|
var newUserListCount = $(".user-list > span").length;
|
|
|
|
$(modalPopupContent).html($('#remove-user-success-content').html());
|
|
|
|
// update user-listing-status-msg with new user-count
|
|
|
|
$("a#remove-user-success-link").click(function () {
|
|
|
|
$("#user-listing-status-msg").text("Total number of Users found : " + newUserListCount);
|
|
|
|
hidePopup();
|
|
|
|
// update modal-content with success message
|
|
|
|
location.reload();
|
|
|
|
$(modalPopupContent).html($('#remove-user-success-content').html());
|
|
|
|
});
|
|
|
|
$("a#remove-user-success-link").click(function () {
|
|
|
|
}
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// error callback
|
|
|
|
function () {
|
|
|
|
function (jqXHR) {
|
|
|
|
|
|
|
|
console.log("error in remove-user API, status code: " + jqXHR.status);
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#remove-user-error-content').html());
|
|
|
|
$(modalPopupContent).html($('#remove-user-error-content').html());
|
|
|
|
$("a#remove-user-error-link").click(function () {
|
|
|
|
$("a#remove-user-error-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
@ -207,23 +186,19 @@ function resetPassword(uname) {
|
|
|
|
//resetPasswordFormData.username = user;
|
|
|
|
//resetPasswordFormData.username = user;
|
|
|
|
resetPasswordFormData.newPassword = unescape(confirmedPassword);
|
|
|
|
resetPasswordFormData.newPassword = unescape(confirmedPassword);
|
|
|
|
|
|
|
|
|
|
|
|
var resetPasswordServiceURL = deviceMgtAPIsBasePath + "/admin/users/"+ user +"/credentials";
|
|
|
|
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ user +"/credentials";
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.post(
|
|
|
|
invokerUtil.post(
|
|
|
|
resetPasswordServiceURL,
|
|
|
|
resetPasswordServiceURL,
|
|
|
|
resetPasswordFormData,
|
|
|
|
resetPasswordFormData,
|
|
|
|
// success callback
|
|
|
|
function (data, textStatus, jqXHR) { // The success callback
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
$(modalPopupContent).html($('#reset-password-success-content').html());
|
|
|
|
$(modalPopupContent).html($('#reset-password-success-content').html());
|
|
|
|
$("a#reset-password-success-link").click(function () {
|
|
|
|
$("a#reset-password-success-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}, function (jqXHR) { // The error callback
|
|
|
|
// error callback
|
|
|
|
|
|
|
|
function (jqXHR) {
|
|
|
|
|
|
|
|
console.log("error in reset-password API, status code: " + jqXHR.status);
|
|
|
|
|
|
|
|
var payload = JSON.parse(jqXHR.responseText);
|
|
|
|
var payload = JSON.parse(jqXHR.responseText);
|
|
|
|
$(errorMsg).text(payload.message);
|
|
|
|
$(errorMsg).text(payload.message);
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
@ -253,7 +228,7 @@ $("#search-btn").click(function () {
|
|
|
|
* when a user clicks on the list item
|
|
|
|
* when a user clicks on the list item
|
|
|
|
* initial mode and with out select mode.
|
|
|
|
* initial mode and with out select mode.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function initiateViewOption() {
|
|
|
|
function InitiateViewOption() {
|
|
|
|
if ($("#can-view").val()) {
|
|
|
|
if ($("#can-view").val()) {
|
|
|
|
$(location).attr('href', $(this).data("url"));
|
|
|
|
$(location).attr('href', $(this).data("url"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -262,137 +237,172 @@ function initiateViewOption() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadUsers() {
|
|
|
|
function loadUsers(searchParam) {
|
|
|
|
var loadingContentIcon = "#loading-content";
|
|
|
|
|
|
|
|
$(loadingContentIcon).show();
|
|
|
|
|
|
|
|
|
|
|
|
$("#loading-content").show();
|
|
|
|
|
|
|
|
|
|
|
|
var dataFilter = function (data) {
|
|
|
|
|
|
|
|
|
|
|
|
var dataFilter = function(data){
|
|
|
|
data = JSON.parse(data);
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
|
|
|
|
var objects = [];
|
|
|
|
var objects = [];
|
|
|
|
|
|
|
|
|
|
|
|
$(data.users).each(
|
|
|
|
$(data.users).each(function( index ) {
|
|
|
|
function (index) {
|
|
|
|
objects.push({
|
|
|
|
objects.push(
|
|
|
|
filter: data.users[index].username,
|
|
|
|
{
|
|
|
|
firstname: data.users[index].firstname ? data.users[index].firstname: '' ,
|
|
|
|
username: data.users[index].username,
|
|
|
|
lastname: data.users[index].lastname ? data.users[index].lastname : '',
|
|
|
|
firstname: data.users[index].firstname ? data.users[index].firstname: '' ,
|
|
|
|
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '',
|
|
|
|
lastname: data.users[index].lastname ? data.users[index].lastname : '',
|
|
|
|
DT_RowId : "role-" + data.users[index].username})
|
|
|
|
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '',
|
|
|
|
});
|
|
|
|
DT_RowId : "user-" + data.users[index].username
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = {
|
|
|
|
json = {
|
|
|
|
"recordsTotal": data.count,
|
|
|
|
"recordsTotal": data.count,
|
|
|
|
"recordsFiltered": data.count,
|
|
|
|
"recordsFiltered": data.count,
|
|
|
|
"data": objects
|
|
|
|
"data": objects
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return JSON.stringify(json);
|
|
|
|
return JSON.stringify( json );
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var fnCreatedRow = function(nRow, aData, iDataIndex) {
|
|
|
|
var fnCreatedRow = function( nRow, aData, iDataIndex ) {
|
|
|
|
console.log(JSON.stringify(aData));
|
|
|
|
|
|
|
|
$(nRow).attr('data-type', 'selectable');
|
|
|
|
$(nRow).attr('data-type', 'selectable');
|
|
|
|
$(nRow).attr('data-username', aData["username"]);
|
|
|
|
$(nRow).attr('data-username', aData["username"]);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var columns = [
|
|
|
|
var columns = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class: "remove-padding icon-only content-fill",
|
|
|
|
class: "remove-padding icon-only content-fill",
|
|
|
|
data: null,
|
|
|
|
data: null,
|
|
|
|
defaultContent:
|
|
|
|
defaultContent: '<div class="thumbnail icon"> <i class="square-element text fw fw-user" style="font-size: 30px;"></i> </div>'
|
|
|
|
'<div class="thumbnail icon">' +
|
|
|
|
|
|
|
|
'<i class="square-element text fw fw-user" style="font-size: 30px;"></i>' +
|
|
|
|
|
|
|
|
'</div>'
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class: "fade-edge",
|
|
|
|
class: "fade-edge",
|
|
|
|
data: null,
|
|
|
|
data: null,
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function ( data, type, row, meta ) {
|
|
|
|
return '<h4>' + data.firstname + ' ' + data.lastname + '</h4>';
|
|
|
|
return '<h4>' + data.firstname + ' ' + data.lastname + '</h4>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class: "fade-edge remove-padding-top",
|
|
|
|
class: "fade-edge remove-padding-top",
|
|
|
|
data: null,
|
|
|
|
data: 'filter',
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function ( filter, type, row, meta ) {
|
|
|
|
return '<i class="fw-user"></i> ' + data.username;
|
|
|
|
return '<i class="fw-user"></i> ' + filter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class: "fade-edge remove-padding-top",
|
|
|
|
class: "fade-edge remove-padding-top",
|
|
|
|
data: null,
|
|
|
|
data: null,
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function ( data, type, row, meta ) {
|
|
|
|
return '<a href="mailto:' + data.emailAddress + ' " class="wr-list-email"><i class="fw-mail"></i> ' +
|
|
|
|
return '<a href="mailto:' + data.emailAddress + ' " class="wr-list-email"> <i class="fw-mail"></i> ' + data.emailAddress + ' </a>';
|
|
|
|
data.emailAddress + ' </a>';
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class: "text-right content-fill text-left-on-grid-view no-wrap",
|
|
|
|
class: "text-right content-fill text-left-on-grid-view no-wrap",
|
|
|
|
data: null,
|
|
|
|
data: null,
|
|
|
|
render: function (data, type, row, meta) {
|
|
|
|
render: function ( data, type, row, meta ) {
|
|
|
|
return '<a href="/emm/users/edit-user?username=' + data.username + '" ' +
|
|
|
|
return '<a href="/emm/users/edit-user?username=' + data.username + '" data-username="' + data.username +
|
|
|
|
'data-username="' + data.username + '" ' +
|
|
|
|
'" data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-user-link"> ' +
|
|
|
|
'data-click-event="edit-form" ' +
|
|
|
|
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' +
|
|
|
|
'class="btn padding-reduce-on-grid-view edit-user-link">' +
|
|
|
|
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' +
|
|
|
|
'<span class="fw-stack">' +
|
|
|
|
|
|
|
|
'<i class="fw fw-ring fw-stack-2x"></i>' +
|
|
|
|
'<a href="#" data-username="' + data.username + '" data-userid=' + data.username +
|
|
|
|
'<i class="fw fw-edit fw-stack-1x"></i>' +
|
|
|
|
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + data.username + '\', \'' +
|
|
|
|
'</span>' +
|
|
|
|
data.username + '\')" class="btn padding-reduce-on-grid-view remove-user-link">' +
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view"> Edit</span>' +
|
|
|
|
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-delete fw-stack-1x">' +
|
|
|
|
'</a>' +
|
|
|
|
'</i> </span> <span class="hidden-xs hidden-on-grid-view">Remove</span> </a>' +
|
|
|
|
'<a href="#" ' +
|
|
|
|
|
|
|
|
'data-username="' + data.username + '" ' +
|
|
|
|
'<a href="#" data-username="' + data.username + '" data-userid="' + data.username +
|
|
|
|
'data-user-id="' + data.username + '" ' +
|
|
|
|
'" data-click-event="edit-form" onclick="javascript:resetPassword(\'' + data.username +
|
|
|
|
'data-click-event="edit-form" ' +
|
|
|
|
'\')" class="btn padding-reduce-on-grid-view remove-user-link"> <span class="fw-stack"> <i class="fw fw-ring fw-stack-2x">' +
|
|
|
|
'onclick="javascript:resetPassword(\'' + data.username + '\')" ' +
|
|
|
|
'</i> <i class="fw fw-key fw-stack-1x"></i> <span class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"><' +
|
|
|
|
'class="btn padding-reduce-on-grid-view remove-user-link">' +
|
|
|
|
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' +
|
|
|
|
'<span class="fw-stack">' +
|
|
|
|
'</i> </span> </span> <span class="hidden-xs hidden-on-grid-view">Reset</span> </a>'
|
|
|
|
'<i class="fw fw-ring fw-stack-2x"></i>' +
|
|
|
|
|
|
|
|
'<i class="fw fw-key fw-stack-1x"></i>' +
|
|
|
|
|
|
|
|
'<span class="fw-stack fw-move-right fw-move-bottom">' +
|
|
|
|
|
|
|
|
'<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i> ' +
|
|
|
|
|
|
|
|
'<i class="fw fw-circle fw-stack-2x"></i>' +
|
|
|
|
|
|
|
|
'<i class="fw fw-refresh fw-stack-1x fw-inverse"></i> ' +
|
|
|
|
|
|
|
|
'</span>' +
|
|
|
|
|
|
|
|
'</span>' +
|
|
|
|
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view"> Reset Password</span>' +
|
|
|
|
|
|
|
|
'</a>' +
|
|
|
|
|
|
|
|
'<a href="#" ' +
|
|
|
|
|
|
|
|
'data-username="' + data.username + '" ' +
|
|
|
|
|
|
|
|
'data-user-id=' + data.username + ' ' +
|
|
|
|
|
|
|
|
'data-click-event="remove-form" ' +
|
|
|
|
|
|
|
|
'onclick="javascript:removeUser(\'' + data.username + '\', \'' + data.username + '\')" ' +
|
|
|
|
|
|
|
|
'class="btn padding-reduce-on-grid-view remove-user-link">' +
|
|
|
|
|
|
|
|
'<span class="fw-stack">' +
|
|
|
|
|
|
|
|
'<i class="fw fw-ring fw-stack-2x"></i>' +
|
|
|
|
|
|
|
|
'<i class="fw fw-delete fw-stack-1x"></i>' +
|
|
|
|
|
|
|
|
'</span>' +
|
|
|
|
|
|
|
|
'<span class="hidden-xs hidden-on-grid-view"> Remove</span> ' +
|
|
|
|
|
|
|
|
'</a>'
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$("#user-grid").datatables_extended_serverside_paging(
|
|
|
|
|
|
|
|
null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null
|
|
|
|
var options = {
|
|
|
|
);
|
|
|
|
"placeholder": "Search By Username",
|
|
|
|
|
|
|
|
"searchKey" : "filter"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
|
|
|
|
|
|
|
|
|
|
|
|
$("#loading-content").hide();
|
|
|
|
$("#loading-content").hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $("#loading-content").show();
|
|
|
|
|
|
|
|
// var userListing = $("#user-listing");
|
|
|
|
|
|
|
|
// var userListingSrc = userListing.attr("src");
|
|
|
|
|
|
|
|
// $.template("user-listing", userListingSrc, function (template) {
|
|
|
|
|
|
|
|
// var serviceURL = apiBasePath + "/users";
|
|
|
|
|
|
|
|
// if (searchParam) {
|
|
|
|
|
|
|
|
// serviceURL = serviceURL + "?filter=" + searchParam;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// var successCallback = function (data) {
|
|
|
|
|
|
|
|
// if (!data) {
|
|
|
|
|
|
|
|
// $('#ast-container').addClass('hidden');
|
|
|
|
|
|
|
|
// $('#user-listing-status-msg').text('No users are available to be displayed.');
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// var canRemove = $("#can-remove").val();
|
|
|
|
|
|
|
|
// var canEdit = $("#can-edit").val();
|
|
|
|
|
|
|
|
// var canResetPassword = $("#can-reset-password").val();
|
|
|
|
|
|
|
|
// data = JSON.parse(data);
|
|
|
|
|
|
|
|
// var viewModel = {};
|
|
|
|
|
|
|
|
// viewModel.users = data.users;
|
|
|
|
|
|
|
|
// for (var i = 0; i < viewModel.users.length; i++) {
|
|
|
|
|
|
|
|
// viewModel.users[i].userid = viewModel.users[i].username.replace(/[^\w\s]/gi, '');
|
|
|
|
|
|
|
|
// if (canRemove) {
|
|
|
|
|
|
|
|
// viewModel.users[i].canRemove = true;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (canEdit) {
|
|
|
|
|
|
|
|
// viewModel.users[i].canEdit = true;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (canResetPassword) {
|
|
|
|
|
|
|
|
// viewModel.users[i].canResetPassword = true;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// viewModel.users[i].adminUser = $("#user-table").data("user");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (data.count > 0) {
|
|
|
|
|
|
|
|
// $('#ast-container').removeClass('hidden');
|
|
|
|
|
|
|
|
// $('#user-listing-status-msg').text("");
|
|
|
|
|
|
|
|
// var content = template(viewModel);
|
|
|
|
|
|
|
|
// $("#ast-container").html(content);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// $('#ast-container').addClass('hidden');
|
|
|
|
|
|
|
|
// $('#user-listing-status-msg').text('No users are available to be displayed.');
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// $("#loading-content").hide();
|
|
|
|
|
|
|
|
// if (isInit) {
|
|
|
|
|
|
|
|
// $('#user-grid').datatables_extended();
|
|
|
|
|
|
|
|
// isInit = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// $(".icon .text").res_text(0.2);
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// invokerUtil.get(serviceURL,
|
|
|
|
|
|
|
|
// successCallback,
|
|
|
|
|
|
|
|
// function (message) {
|
|
|
|
|
|
|
|
// $('#ast-container').addClass('hidden');
|
|
|
|
|
|
|
|
// $('#user-listing-status-msg').
|
|
|
|
|
|
|
|
// text('Invalid search query. Try again with a valid search query');
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
$(document).ready(function () {
|
|
|
|
loadUsers();
|
|
|
|
loadUsers();
|
|
|
|
|
|
|
|
|
|
|
|
$(".viewEnabledIcon").click(function () {
|
|
|
|
$(".viewEnabledIcon").click(function () {
|
|
|
|
initiateViewOption();
|
|
|
|
InitiateViewOption();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (!$("#can-invite").val()) {
|
|
|
|
if (!$("#can-invite").val()) {
|
|
|
|
$("#invite-user-button").remove();
|
|
|
|
$("#invite-user-button").remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|