|
|
@ -25,6 +25,7 @@
|
|
|
|
errorMessage: ""
|
|
|
|
errorMessage: ""
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ReadOnlyPermission = "Read Only User";
|
|
|
|
var open = false;
|
|
|
|
var open = false;
|
|
|
|
|
|
|
|
|
|
|
|
// Select a user to populate on the right side
|
|
|
|
// Select a user to populate on the right side
|
|
|
@ -63,14 +64,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
// Create a user, do some validation too
|
|
|
|
// Create a user, do some validation too
|
|
|
|
$scope.addUser = function () {
|
|
|
|
$scope.addUser = function () {
|
|
|
|
|
|
|
|
|
|
|
|
if (!$scope.user.username || !$scope.user.password) {
|
|
|
|
if (!$scope.user.username || !$scope.user.password) {
|
|
|
|
$scope.error.error = true;
|
|
|
|
$scope.error.error = true;
|
|
|
|
$scope.error.errorMessage = "Please provide a correct username and password";
|
|
|
|
$scope.error.errorMessage = "Please provide a correct username and password";
|
|
|
|
generateNotify($scope.error.errorMessage, 'warning');
|
|
|
|
generateNotify($scope.error.errorMessage, 'warning');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($scope.selectedPermissions.length === 0) {
|
|
|
|
if ($scope.selectedPermissions.length === 0) {
|
|
|
|
$scope.error.error = true;
|
|
|
|
$scope.error.error = true;
|
|
|
|
$scope.error.errorMessage = "Please select a permission";
|
|
|
|
$scope.error.errorMessage = "Please select a permission";
|
|
|
@ -78,6 +77,16 @@
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hasReadOnly = $scope.selectedPermissions.indexOf(ReadOnlyPermission) !== -1;
|
|
|
|
|
|
|
|
if (hasReadOnly) {
|
|
|
|
|
|
|
|
if ($scope.selectedPermissions.length > 1) {
|
|
|
|
|
|
|
|
$scope.error.error = true;
|
|
|
|
|
|
|
|
$scope.error.errorMessage = "Cannot have the " + ReadOnlyPermission + " permission with other permissions.";
|
|
|
|
|
|
|
|
generateNotify($scope.error.errorMessage, 'danger');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
userManagementService.addUser($scope.user, $scope.selectedPermissions, $scope.selectedFeatures)
|
|
|
|
userManagementService.addUser($scope.user, $scope.selectedPermissions, $scope.selectedFeatures)
|
|
|
|
.then(function (data) {
|
|
|
|
.then(function (data) {
|
|
|
|
if (data.message) {
|
|
|
|
if (data.message) {
|
|
|
@ -86,17 +95,8 @@
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$scope.users.push(data.data); // Push the new user into the array to update the DOM
|
|
|
|
$scope.users.push(data.data); // Push the new user into the array to update the DOM
|
|
|
|
$scope.user = {};
|
|
|
|
$scope.user = {};
|
|
|
|
$scope.selectedPermissions = {}; // Clear the checkboxes
|
|
|
|
clearCheckboxes();
|
|
|
|
$scope.selectedFeatures = {};
|
|
|
|
};
|
|
|
|
$scope.features.forEach(function (entry) {
|
|
|
|
|
|
|
|
entry.selected = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.permissions.forEach(function (entry) {
|
|
|
|
|
|
|
|
entry.selected = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$scope.closeSidebarClick = function() {
|
|
|
|
$scope.closeSidebarClick = function () {
|
|
|
|
return closeSidebar();
|
|
|
|
return closeSidebar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -178,6 +178,17 @@
|
|
|
|
$("#wrapper").toggleClass("toggled");
|
|
|
|
$("#wrapper").toggleClass("toggled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clearCheckboxes() {
|
|
|
|
|
|
|
|
$scope.selectedPermissions = {}; // Clear the checkboxes
|
|
|
|
|
|
|
|
$scope.selectedFeatures = {};
|
|
|
|
|
|
|
|
$scope.features.forEach(function (entry) {
|
|
|
|
|
|
|
|
entry.selected = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.permissions.forEach(function (entry) {
|
|
|
|
|
|
|
|
entry.selected = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function successCallback(message, type) {
|
|
|
|
function successCallback(message, type) {
|
|
|
|