From 121cf90ba7d0a136c6aa6a5b8b42d193ca331058 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Thu, 8 Dec 2016 13:50:51 +0000 Subject: [PATCH] Removed the whitelist --- .../SettingModels/PlexRequestSettings.cs | 22 ------------------- .../Jobs/FaultQueueHandler.cs | 5 ----- PlexRequests.UI/Modules/SearchModule.cs | 6 ++--- PlexRequests.UI/Views/Admin/Settings.cshtml | 13 ----------- 4 files changed, 3 insertions(+), 43 deletions(-) diff --git a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs index 2a0713375..f4aec5a96 100644 --- a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs +++ b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs @@ -58,7 +58,6 @@ namespace PlexRequests.Core.SettingModels public int MovieWeeklyRequestLimit { get; set; } public int TvWeeklyRequestLimit { get; set; } public int AlbumWeeklyRequestLimit { get; set; } - public string NoApprovalUsers { get; set; } public bool CollectAnalyticData { get; set; } public bool IgnoreNotifyForAutoApprovedRequests { get; set; } public bool Wizard { get; set; } @@ -75,26 +74,5 @@ namespace PlexRequests.Core.SettingModels public string ThemeName { get; set; } public string ApiKey { get; set; } - - [JsonIgnore] - public List ApprovalWhiteList - { - get - { - var users = new List(); - if (string.IsNullOrEmpty(NoApprovalUsers)) - { - return users; - } - - var splitUsers = NoApprovalUsers.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - foreach (var user in splitUsers) - { - if (!string.IsNullOrWhiteSpace(user)) - users.Add(user.Trim()); - } - return users; - } - } } } diff --git a/PlexRequests.Services/Jobs/FaultQueueHandler.cs b/PlexRequests.Services/Jobs/FaultQueueHandler.cs index e269231ee..b83446610 100644 --- a/PlexRequests.Services/Jobs/FaultQueueHandler.cs +++ b/PlexRequests.Services/Jobs/FaultQueueHandler.cs @@ -302,11 +302,6 @@ namespace PlexRequests.Services.Jobs public bool ShouldAutoApprove(RequestType requestType, PlexRequestSettings prSettings, List username) { - if (prSettings.ApprovalWhiteList.Intersect(username).Any()) - { - return true; - } - foreach (var user in username) { var admin = Security.HasPermissions(user, Permissions.Administrator); diff --git a/PlexRequests.UI/Modules/SearchModule.cs b/PlexRequests.UI/Modules/SearchModule.cs index 51c348d31..c5c02111b 100644 --- a/PlexRequests.UI/Modules/SearchModule.cs +++ b/PlexRequests.UI/Modules/SearchModule.cs @@ -1234,7 +1234,7 @@ namespace PlexRequests.UI.Modules if (IsAdmin) return true; - if (s.ApprovalWhiteList.Contains(Username)) + if (ShouldAutoApprove(type,s,Username)) return true; var requestLimit = GetRequestLimitForType(type, s); @@ -1376,8 +1376,8 @@ namespace PlexRequests.UI.Modules public bool ShouldAutoApprove(RequestType requestType, PlexRequestSettings prSettings, string username) { var admin = Security.HasPermissions(Context.CurrentUser, Permissions.Administrator); - // if the user is an admin or they are whitelisted, they go ahead and allow auto-approval - if (admin || prSettings.ApprovalWhiteList.Any(x => x.Equals(username, StringComparison.OrdinalIgnoreCase))) return true; + // if the user is an admin, they go ahead and allow auto-approval + if (admin) return true; // check by request type if the category requires approval or not switch (requestType) diff --git a/PlexRequests.UI/Views/Admin/Settings.cshtml b/PlexRequests.UI/Views/Admin/Settings.cshtml index 2acd02a22..2951b5162 100644 --- a/PlexRequests.UI/Views/Admin/Settings.cshtml +++ b/PlexRequests.UI/Views/Admin/Settings.cshtml @@ -199,19 +199,6 @@ - - - - -

A comma separated list of users whose requests do not require approval (These users also do not have a request limit).

-
- -
- -
-
- -

If the request limits are set to 0 then no request limit is applied.