mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
All Sln changes
This commit is contained in:
parent
b5855f2644
commit
796f0fc188
615 changed files with 68 additions and 747 deletions
8
Ombi.UI/Content/app/app.js
Normal file
8
Ombi.UI/Content/app/app.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
module = angular.module('PlexRequests', ['ngLoadingSpinner']);
|
||||
module.constant("moment", moment);
|
||||
|
||||
//module.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
|
||||
// usSpinnerConfigProvider.setDefaults({ color: 'white' });
|
||||
//}]);
|
||||
}());
|
51
Ombi.UI/Content/app/requests/requestsController.js
Normal file
51
Ombi.UI/Content/app/requests/requestsController.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
(function () {
|
||||
var controller = function($scope, requestsService) {
|
||||
|
||||
$scope.requests = [];
|
||||
$scope.selectedTab = {};
|
||||
$scope.currentPage = 1;
|
||||
$scope.tabs = [];
|
||||
|
||||
$scope.plexSettings = {};
|
||||
$scope.requestSettings = {};
|
||||
|
||||
// Search
|
||||
$scope.searchTerm = "";
|
||||
|
||||
|
||||
// Called on page load
|
||||
$scope.init = function() {
|
||||
// Get the settings
|
||||
$scope.plexSettings = requestsService.getPlexRequestSettings(getBaseUrl());
|
||||
$scope.requestSettings = requestsService.getRequestSettings(getBaseUrl());
|
||||
|
||||
if ($scope.plexSettings.SearchForMovies) {
|
||||
$scope.selectedTab = "movies";
|
||||
|
||||
// Load the movie Requests
|
||||
$scope.requests = requestsService.getRequests("movie", getBaseUrl());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.changeTab = function(tab) {
|
||||
// load the data from the tab
|
||||
switch (tab) {
|
||||
// Set the selected tab and load the appropriate data
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.search = function() {
|
||||
$scope.requests = requestsService.getRequests
|
||||
};
|
||||
|
||||
function getBaseUrl() {
|
||||
return $('#baseUrl').val();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').controller('requestsController', ["$scope", "requestsService", controller]);
|
||||
}());
|
49
Ombi.UI/Content/app/requests/requestsService.js
Normal file
49
Ombi.UI/Content/app/requests/requestsService.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
(function () {
|
||||
|
||||
var requestsService = function ($http) {
|
||||
|
||||
$http.defaults.headers.common['Content-Type'] = 'application/json'; // Set default headers
|
||||
|
||||
var getRequests = function (type, baseUrl) {
|
||||
switch (type) {
|
||||
case "movie":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/movies"));
|
||||
case "tv":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/tvshows"));
|
||||
case "album":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/albums"));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var getPlexRequestSettings = function (baseUrl) {
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/plexrequestsettings"));
|
||||
}
|
||||
|
||||
var getRequestsSettings = function (baseUrl) {
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/requestsettings"));
|
||||
}
|
||||
|
||||
var getRequestsSearch = function (type, baseUrl, searchTerm) {
|
||||
switch (type) {
|
||||
case "movie":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/movies/"+ searchTerm));
|
||||
case "tv":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/tvshows/" + searchTerm));
|
||||
case "album":
|
||||
return $http.get(createBaseUrl(baseUrl, "/requestsbeta/albums/" + searchTerm));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
return {
|
||||
getRequests: getRequests,
|
||||
getRequestsSearch: getRequestsSearch,
|
||||
getPlexRequestSettings: getPlexRequestSettings,
|
||||
getRequestSettings: getRequestsSettings
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').factory('requestsService', ["$http", requestsService]);
|
||||
|
||||
}());
|
39
Ombi.UI/Content/app/userManagement/Directives/addUser.html
Normal file
39
Ombi.UI/Content/app/userManagement/Directives/addUser.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<form name="userform" ng-submit="addUser()" novalidate>
|
||||
<div class="form-group">
|
||||
<input id="username" type="text" placeholder="user" ng-model="user.username" class="form-control form-control-custom" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="password" type="password" placeholder="password" ng-model="user.password" class="form-control form-control-custom" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="email" type="email" placeholder="email address" ng-model="user.email" class="form-control form-control-custom" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div>
|
||||
<h3 class="col-md-5">Permissions: </h3>
|
||||
<h3 class="col-md-5">Features: </h3>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="checkbox" ng-repeat="permission in permissions">
|
||||
<input id="permission_{{$id}}" class="checkbox-custom" name="permission[]"
|
||||
ng-checked="permission.selected" ng-model="permission.selected" type="checkbox" value="{{permission.value}}"/>
|
||||
<label for="permission_{{$id}}">{{permission.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<div class="checkbox" ng-repeat="f in features">
|
||||
<input id="features_{{$id}}" class="checkbox-custom" name="f[]"
|
||||
ng-checked="f.selected" ng-model="f.selected" type="checkbox" value="{{f.value}}"/>
|
||||
<label for="features_{{$id}}">{{f.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<input type="submit" class="btn btn-success-outline" value="Add" />
|
||||
|
||||
<button type="button" ng-click="redirectToSettings()" class="btn btn-primary-outline" style="float: right; margin-right: 10px;">Settings</button>
|
||||
</div>
|
||||
</form>
|
57
Ombi.UI/Content/app/userManagement/Directives/sidebar.html
Normal file
57
Ombi.UI/Content/app/userManagement/Directives/sidebar.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!--Sidebar-->
|
||||
<div id="sidebar-wrapper" class="shadow">
|
||||
<div style="margin-left:15px">
|
||||
<br />
|
||||
<br />
|
||||
<img ng-show="selectedUser.plexInfo.thumb" class="col-md-pull-1 img-circle" style="position: absolute" ng-src="{{selectedUser.plexInfo.thumb}}" />
|
||||
<div hidden="hidden" ng-bind="selectedUser.id"></div>
|
||||
<div>
|
||||
<strong>Username: </strong><span ng-bind="selectedUser.username"></span>
|
||||
</div>
|
||||
<div ng-show="selectedUser.emailAddress">
|
||||
<strong>Email Address: </strong><span ng-bind="selectedUser.emailAddress"></span>
|
||||
</div>
|
||||
<div>
|
||||
<strong>User Type: </strong><span ng-bind="selectedUser.type === 1 ? 'Local User' : 'Plex User'"></span>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<div ng-show="selectedUser">
|
||||
<!--Edit-->
|
||||
<div class="row" style="margin-left: 0; margin-right: 0;">
|
||||
<div class="col-md-6">
|
||||
<strong>Modify Permissions:</strong>
|
||||
<!--Load all permissions-->
|
||||
|
||||
<div class="checkbox small-checkbox" ng-repeat="p in selectedUser.permissions">
|
||||
<input id="permissionsCheckbox_{{$id}}" class="checkbox-custom" name="permissions[]" ng-checked="p.selected" ng-model="p.selected" type="checkbox" value="{{p.value}}" />
|
||||
<label class="small-label" for="permissionsCheckbox_{{$id}}">{{p.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>Modify Features:</strong>
|
||||
<!--Load all features-->
|
||||
<div class="checkbox small-checkbox" ng-repeat="p in selectedUser.features">
|
||||
<input id="featuresCheckbox_{{$id}}" class="checkbox-custom" name="features[]" ng-checked="p.selected" ng-model="p.selected" type="checkbox" value="{{p.value}}" />
|
||||
<label class="small-label" for="featuresCheckbox_{{$id}}">{{p.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<strong>Email Address</strong>
|
||||
<div class="form-group">
|
||||
<input id="emailAddress" type="email" ng-model="selectedUser.emailAddress" ng-disabled="selectedUser.type === 0" class="form-control form-control-custom" />
|
||||
</div>
|
||||
|
||||
<strong>Alias</strong>
|
||||
<div class="form-group">
|
||||
<input id="alias" type="text" ng-model="selectedUser.alias" class="form-control form-control-custom" />
|
||||
</div>
|
||||
|
||||
|
||||
<button ng-click="updateUser()" class="btn btn-primary-outline">Update</button>
|
||||
<button ng-click="deleteUser()" class="btn btn-danger-outline">Delete</button>
|
||||
<button ng-click="closeSidebarClick()" style="float: right; margin-right: 10px;" class="btn btn-danger-outline">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--SideBar End-->
|
86
Ombi.UI/Content/app/userManagement/Directives/table.html
Normal file
86
Ombi.UI/Content/app/userManagement/Directives/table.html
Normal file
|
@ -0,0 +1,86 @@
|
|||
|
||||
<!--Search-->
|
||||
<form>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
|
||||
<input type="text" class="form-control" placeholder="Search" ng-model="searchTerm">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Table -->
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<a href="#IDoNotExist" ng-click="sortType = 'username'; sortReverse = !sortReverse">
|
||||
Username
|
||||
<span ng-show="sortType == 'username' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'username' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="#IDoNotExist" ng-click="sortType = 'alias'; sortReverse = !sortReverse">
|
||||
Alias
|
||||
<span ng-show="sortType == 'alias' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'alias' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="#IDoNotExist" ng-click="sortType = 'emailAddress'; sortReverse = !sortReverse">
|
||||
Email
|
||||
<span ng-show="sortType == 'emailAddress' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'emailAddress' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
Permissions
|
||||
</th>
|
||||
<th ng-hide="hideColumns">
|
||||
<a href="#IDoNotExist" ng-click="sortType = 'type'; sortReverse = !sortReverse">
|
||||
User Type
|
||||
<span ng-show="sortType == 'type' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'type' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
|
||||
<th ng-hide="hideColumns">
|
||||
<a href="#IDoNotExist" ng-click="sortType = 'lastLoggedIn'; sortReverse = !sortReverse">
|
||||
Last Logged In
|
||||
<span ng-show="sortType == 'lastLoggedIn' && !sortReverse" class="fa fa-caret-down"></span>
|
||||
<span ng-show="sortType == 'lastLoggedIn' && sortReverse" class="fa fa-caret-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="u in users | orderBy:sortType:sortReverse | filter:searchTerm">
|
||||
<td>
|
||||
{{u.username}}
|
||||
</td>
|
||||
<td>
|
||||
{{u.alias}}
|
||||
</td>
|
||||
<td>
|
||||
{{u.emailAddress}}
|
||||
</td>
|
||||
<td>
|
||||
{{u.permissionsFormattedString}}
|
||||
</td>
|
||||
<td ng-hide="hideColumns">
|
||||
{{u.type === 1 ? 'Local User' : 'Plex User'}}
|
||||
</td>
|
||||
<td ng-hide="hideColumns" ng-bind="u.lastLoggedIn === minDate ? 'Never' : formatDate(u.lastLoggedIn)"></td>
|
||||
<td>
|
||||
<a href="#IDontExist" ng-click="selectUser(u.id)" class="btn btn-sm btn-info-outline">Details/Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,25 @@
|
|||
(function () {
|
||||
|
||||
module.directive('tableComponent',
|
||||
function () {
|
||||
return {
|
||||
templateUrl: createBaseUrl(getBaseUrl(), 'Content/app/userManagement/Directives/table.html')
|
||||
};
|
||||
})
|
||||
.directive('addUser',
|
||||
function () {
|
||||
return {
|
||||
templateUrl: createBaseUrl(getBaseUrl(), 'Content/app/userManagement/Directives/addUser.html')
|
||||
};
|
||||
})
|
||||
.directive('sidebar',
|
||||
function () {
|
||||
return {
|
||||
templateUrl: createBaseUrl(getBaseUrl(), 'Content/app/userManagement/Directives/sidebar.html')
|
||||
};
|
||||
});
|
||||
|
||||
function getBaseUrl() {
|
||||
return $('#baseUrl').text();
|
||||
}
|
||||
})();
|
213
Ombi.UI/Content/app/userManagement/userManagementController.js
Normal file
213
Ombi.UI/Content/app/userManagement/userManagementController.js
Normal file
|
@ -0,0 +1,213 @@
|
|||
(function () {
|
||||
|
||||
var controller = function ($scope, userManagementService, moment) {
|
||||
|
||||
$scope.user = {}; // The local user
|
||||
$scope.users = []; // list of users
|
||||
|
||||
$scope.features = []; // List of features
|
||||
$scope.permissions = []; // List of permissions
|
||||
|
||||
$scope.selectedUser = {}; // User on the right side
|
||||
|
||||
$scope.selectedFeatures = {};
|
||||
$scope.selectedPermissions = {};
|
||||
|
||||
$scope.minDate = "0001-01-01T00:00:00.0000000+00:00";
|
||||
|
||||
$scope.sortType = "username";
|
||||
$scope.sortReverse = false;
|
||||
$scope.searchTerm = "";
|
||||
|
||||
$scope.hideColumns = false;
|
||||
|
||||
var ReadOnlyPermission = "Read Only User";
|
||||
var open = false;
|
||||
|
||||
// Select a user to populate on the right side
|
||||
$scope.selectUser = function (id) {
|
||||
var user = $scope.users.filter(function (item) {
|
||||
return item.id === id;
|
||||
});
|
||||
$scope.selectedUser = user[0];
|
||||
|
||||
openSidebar();
|
||||
}
|
||||
|
||||
// Get all users in the system
|
||||
$scope.getUsers = function () {
|
||||
$scope.users = userManagementService.getUsers()
|
||||
.then(function (data) {
|
||||
$scope.users = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
// Get the permissions and features and populate the create dropdown
|
||||
$scope.getFeaturesPermissions = function () {
|
||||
userManagementService.getFeatures()
|
||||
.then(function (data) {
|
||||
$scope.features = data.data;
|
||||
});
|
||||
|
||||
userManagementService.getPermissions()
|
||||
.then(function (data) {
|
||||
$scope.permissions = data.data;
|
||||
});
|
||||
}
|
||||
|
||||
// Create a user, do some validation too
|
||||
$scope.addUser = function () {
|
||||
if (!$scope.user.username || !$scope.user.password) {
|
||||
generateNotify("Please provide a username and password", 'warning');
|
||||
return;
|
||||
}
|
||||
if ($scope.selectedPermissions.length === 0) {
|
||||
generateNotify("Please select a permission", 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var hasReadOnly = $scope.selectedPermissions.indexOf(ReadOnlyPermission) !== -1;
|
||||
if (hasReadOnly) {
|
||||
if ($scope.selectedPermissions.length > 1) {
|
||||
generateNotify("Cannot have the " + ReadOnlyPermission + " permission with other permissions.", 'danger');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var existingUsername = $scope.users.some(function (u) {
|
||||
return u.username === $scope.user.username;
|
||||
});
|
||||
|
||||
if (existingUsername) {
|
||||
return generateNotify("A user with the username " + $scope.user.username + " already exists!", 'danger');
|
||||
}
|
||||
|
||||
userManagementService.addUser($scope.user, $scope.selectedPermissions, $scope.selectedFeatures)
|
||||
.then(function (data) {
|
||||
if (data.message) {
|
||||
generateNotify(data.message, 'warning');
|
||||
} else {
|
||||
$scope.users.push(data.data); // Push the new user into the array to update the DOM
|
||||
$scope.user = {};
|
||||
clearCheckboxes();
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
// Watch the checkboxes for updates (Creating a user)
|
||||
$scope.$watch('features|filter:{selected:true}',
|
||||
function (nv) {
|
||||
$scope.selectedFeatures = nv.map(function (f) {
|
||||
return f.name;
|
||||
});
|
||||
},
|
||||
true);
|
||||
|
||||
$scope.$watch('permissions|filter:{selected:true}',
|
||||
function (nv) {
|
||||
$scope.selectedPermissions = nv.map(function (f) {
|
||||
return f.name;
|
||||
});
|
||||
},
|
||||
true);
|
||||
|
||||
|
||||
$scope.updateUser = function () {
|
||||
var u = $scope.selectedUser;
|
||||
userManagementService.updateUser(u.id, u.permissions, u.features, u.alias, u.emailAddress)
|
||||
.then(function success(data) {
|
||||
if (data.data) {
|
||||
$scope.selectedUser = data.data;
|
||||
|
||||
closeSidebar();
|
||||
return successCallback("Updated User", "success");
|
||||
}
|
||||
}, function errorCallback(response) {
|
||||
successCallback(response, "danger");
|
||||
});
|
||||
}
|
||||
|
||||
$scope.deleteUser = function () {
|
||||
var u = $scope.selectedUser;
|
||||
userManagementService.deleteUser(u.id)
|
||||
.then(function sucess(data) {
|
||||
if (data.data.result) {
|
||||
removeUser(u.id, true);
|
||||
closeSidebar();
|
||||
return successCallback("Deleted User", "success");
|
||||
}
|
||||
}, function errorCallback(response) {
|
||||
successCallback(response, "danger");
|
||||
});
|
||||
}
|
||||
|
||||
$scope.formatDate = function (utcDate) {
|
||||
return moment.utc(utcDate).local().format('lll');
|
||||
}
|
||||
|
||||
|
||||
// On page load
|
||||
$scope.init = function () {
|
||||
$scope.getUsers();
|
||||
$scope.getFeaturesPermissions();
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.closeSidebarClick = function () {
|
||||
return closeSidebar();
|
||||
}
|
||||
|
||||
$scope.redirectToSettings = function() {
|
||||
var url = createBaseUrl(getBaseUrl(), '/admin/usermanagementsettings');
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
function removeUser(id, current) {
|
||||
$scope.users = $scope.users.filter(function (user) {
|
||||
return user.id !== id;
|
||||
});
|
||||
if (current) {
|
||||
$scope.selectedUser = null;
|
||||
}
|
||||
}
|
||||
|
||||
function closeSidebar() {
|
||||
if (open) {
|
||||
open = false;
|
||||
$("#wrapper").toggleClass("toggled");
|
||||
$scope.hideColumns = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openSidebar() {
|
||||
if (!open) {
|
||||
$("#wrapper").toggleClass("toggled");
|
||||
open = true;
|
||||
$scope.hideColumns = true;
|
||||
}
|
||||
}
|
||||
|
||||
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 getBaseUrl() {
|
||||
return $('#baseUrl').text();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function successCallback(message, type) {
|
||||
generateNotify(message, type);
|
||||
};
|
||||
|
||||
angular.module('PlexRequests').controller('userManagementController', ["$scope", "userManagementService", "moment", controller]);
|
||||
}());
|
93
Ombi.UI/Content/app/userManagement/userManagementService.js
Normal file
93
Ombi.UI/Content/app/userManagement/userManagementService.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
(function () {
|
||||
|
||||
var userManagementService = function ($http) {
|
||||
|
||||
$http.defaults.headers.common['Content-Type'] = 'application/json'; // Set default headers
|
||||
|
||||
|
||||
|
||||
var getUsers = function () {
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/users');
|
||||
return $http.get(url);
|
||||
};
|
||||
|
||||
var addUser = function (user, permissions, features) {
|
||||
if (!user || permissions.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isArray(permissions)) {
|
||||
permissions = [];
|
||||
}
|
||||
if (!isArray(features)) {
|
||||
features = [];
|
||||
}
|
||||
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/createuser');
|
||||
|
||||
return $http({
|
||||
url: url,
|
||||
method: "POST",
|
||||
data: { username: user.username, password: user.password, permissions: permissions, features : features, email: user.email }
|
||||
});
|
||||
}
|
||||
|
||||
var getFeatures = function () {
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/features');
|
||||
return $http.get(url);
|
||||
}
|
||||
|
||||
var getPermissions = function () {
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/permissions');
|
||||
return $http.get(url);
|
||||
|
||||
}
|
||||
|
||||
var updateUser = function (id, permissions, features, alias, email) {
|
||||
|
||||
if (!isArray(permissions)) {
|
||||
permissions = [];
|
||||
}
|
||||
if (!isArray(features)) {
|
||||
features = [];
|
||||
}
|
||||
|
||||
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/updateUser');
|
||||
return $http({
|
||||
url: url,
|
||||
method: "POST",
|
||||
data: { id: id, permissions: permissions, features: features, alias: alias, emailAddress: email },
|
||||
});
|
||||
}
|
||||
|
||||
var deleteUser = function (id) {
|
||||
|
||||
var url = createBaseUrl(getBaseUrl(), '/usermanagement/deleteUser');
|
||||
return $http({
|
||||
url: url,
|
||||
method: "POST",
|
||||
data: { id: id }
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
getUsers: getUsers,
|
||||
addUser: addUser,
|
||||
getFeatures: getFeatures,
|
||||
getPermissions: getPermissions,
|
||||
updateUser: updateUser,
|
||||
deleteUser: deleteUser
|
||||
};
|
||||
}
|
||||
function getBaseUrl() {
|
||||
return $('#baseUrl').text();
|
||||
}
|
||||
|
||||
function isArray(obj) {
|
||||
return !!obj && Array === obj.constructor;
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').factory('userManagementService', ["$http", userManagementService]);
|
||||
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue