You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/PlexRequests.UI/Content/app/userManagement/userManagementService.js

59 lines
1.8 KiB

9 years ago
(function () {
var userManagementService = function ($http) {
$http.defaults.headers.common['Content-Type'] = 'application/json'; // Set default headers
9 years ago
var getUsers = function () {
return $http.get('/usermanagement/users');
};
8 years ago
var addUser = function (user, permissions, features) {
if (!user || permissions.length === 0) {
return null;
}
9 years ago
return $http({
9 years ago
url: '/usermanagement/createuser',
method: "POST",
8 years ago
data: { username: user.username, password: user.password, permissions: permissions, features : features, email: user.email }
9 years ago
});
}
8 years ago
var getFeatures = function () {
return $http.get('/usermanagement/features');
9 years ago
}
8 years ago
var getPermissions = function () {
return $http.get('/usermanagement/permissions');
}
var updateUser = function (id, permissions, features, alias, email) {
return $http({
url: '/usermanagement/updateUser',
method: "POST",
data: { id: id, permissions: permissions, features: features, alias: alias, emailAddress: email },
});
}
var deleteUser = function (id) {
return $http({
url: '/usermanagement/deleteUser',
method: "POST",
data: { id: id }
});
}
9 years ago
return {
getUsers: getUsers,
9 years ago
addUser: addUser,
8 years ago
getFeatures: getFeatures,
getPermissions: getPermissions,
updateUser: updateUser,
deleteUser: deleteUser
9 years ago
};
}
angular.module('PlexRequests').factory('userManagementService', ["$http", userManagementService]);
}());