diff --git a/Ombi.Api.Models/Watcher/WatcherResponse.cs b/Ombi.Api.Models/Watcher/WatcherResponse.cs new file mode 100644 index 000000000..99f951447 --- /dev/null +++ b/Ombi.Api.Models/Watcher/WatcherResponse.cs @@ -0,0 +1,8 @@ +using System; +namespace Ombi.Api.Models +{ + public class WatcherResponse + { + + } +} diff --git a/Ombi.UI/Content/app/userManagement/userManagementController.js b/Ombi.UI/Content/app/userManagement/userManagementController.js index 7803318d7..de6c3f14f 100644 --- a/Ombi.UI/Content/app/userManagement/userManagementController.js +++ b/Ombi.UI/Content/app/userManagement/userManagementController.js @@ -74,6 +74,8 @@ } } + if(Array.isArray($scope.users)){ + var existingUsername = $scope.users.some(function (u) { return u.username === $scope.user.username; }); @@ -81,6 +83,7 @@ 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) { @@ -92,6 +95,8 @@ clearCheckboxes(); }; }); + + }; // Watch the checkboxes for updates (Creating a user) diff --git a/Ombi.UI/Modules/UserManagementModule.cs b/Ombi.UI/Modules/UserManagementModule.cs index 1a2581d40..bcf41d3a1 100644 --- a/Ombi.UI/Modules/UserManagementModule.cs +++ b/Ombi.UI/Modules/UserManagementModule.cs @@ -86,23 +86,20 @@ namespace Ombi.UI.Modules { //Get Plex Users var plexUsers = PlexApi.GetUsers(plexSettings.PlexAuthToken); + if (plexUsers != null && plexUsers.User != null) { + foreach (var u in plexUsers.User) { + var dbUser = plexDbUsers.FirstOrDefault (x => x.PlexUserId == u.Id); + var userDb = userLogins.FirstOrDefault (x => x.UserId == u.Id); - foreach (var u in plexUsers.User) - { - var dbUser = plexDbUsers.FirstOrDefault(x => x.PlexUserId == u.Id); - var userDb = userLogins.FirstOrDefault(x => x.UserId == u.Id); - - // We don't have the user in the database yet - if (dbUser == null) - { - model.Add(MapPlexUser(u, null, userDb?.LastLoggedIn ?? DateTime.MinValue)); - } - else - { - // The Plex User is in the database - model.Add(MapPlexUser(u, dbUser, userDb?.LastLoggedIn ?? DateTime.MinValue)); - } - } + // We don't have the user in the database yet + if (dbUser == null) { + model.Add (MapPlexUser (u, null, userDb?.LastLoggedIn ?? DateTime.MinValue)); + } else { + // The Plex User is in the database + model.Add (MapPlexUser (u, dbUser, userDb?.LastLoggedIn ?? DateTime.MinValue)); + } + } + } // Also get the server admin var account = PlexApi.GetAccount(plexSettings.PlexAuthToken); diff --git a/PlexRequests.sln.DotSettings b/PlexRequests.sln.DotSettings deleted file mode 100644 index 6c902f71f..000000000 --- a/PlexRequests.sln.DotSettings +++ /dev/null @@ -1,27 +0,0 @@ - - /************************************************************************ - Copyright (c) $CURRENT_YEAR$ Jamie Rees - File: $FILENAME$ - Created By: $USER_NAME$ - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ************************************************************************/ - - Copyright \ No newline at end of file