Merge pull request #1174 from distaula/ViewUserRequests

Added permission to see who made requests.
pull/1215/head
Jamie 8 years ago committed by GitHub
commit 1021877e6d

@ -38,6 +38,7 @@ namespace Ombi.Core.SettingModels
public bool UsersCanViewOnlyOwnRequests { get; set; }
public bool UsersCanViewOnlyOwnIssues { get; set; }
public bool BypassRequestLimit { get; set; }
public bool ViewUsers { get; set; }
// Features
public bool RecentlyAddedNotification { get; set; }

@ -73,6 +73,9 @@ namespace Ombi.Helpers.Permissions
UsersCanViewOnlyOwnIssues = 2048,
[Display(Name = "Bypass the request limit")]
BypassRequestLimit = 4096
BypassRequestLimit = 4096,
[Display(Name = "User can see who requested")]
ViewUsers = 8192
}
}

@ -208,6 +208,8 @@ namespace Ombi.UI.Modules
var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests);
var allowViewUsers = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ViewUsers);
var viewModel = dbMovies.Select(movie => new RequestViewModel
{
ProviderId = movie.ProviderId,
@ -224,7 +226,7 @@ namespace Ombi.UI.Modules
Approved = movie.Available || movie.Approved,
Title = movie.Title,
Overview = movie.Overview,
RequestedUsers = canManageRequest ? movie.AllUsers.ToArray() : new string[] { },
RequestedUsers = canManageRequest || allowViewUsers ? movie.AllUsers.ToArray() : new string[] { },
ReleaseYear = movie.ReleaseDate.Year.ToString(),
Available = movie.Available,
Admin = canManageRequest,
@ -294,6 +296,8 @@ namespace Ombi.UI.Modules
var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests);
var allowViewUsers = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ViewUsers);
var viewModel = dbTv.Select(tv => new RequestViewModel
{
ProviderId = tv.ProviderId,
@ -310,7 +314,7 @@ namespace Ombi.UI.Modules
Approved = tv.Available || tv.Approved,
Title = tv.Title,
Overview = tv.Overview,
RequestedUsers = canManageRequest ? tv.AllUsers.ToArray() : new string[] { },
RequestedUsers = canManageRequest || allowViewUsers ? tv.AllUsers.ToArray() : new string[] { },
ReleaseYear = tv.ReleaseDate.Year.ToString(),
Available = tv.Available,
Admin = canManageRequest,

@ -1,4 +1,4 @@
@using Ombi.UI.Helpers
@using Ombi.UI.Helpers
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.Core.SettingModels.UserManagementSettings>
@Html.Partial("Shared/Partial/_Sidebar")
@ -25,6 +25,7 @@
@Html.Checkbox(Model.UsersCanViewOnlyOwnIssues, "UsersCanViewOnlyOwnIssues", "Users can only view their own issues")
@Html.Checkbox(Model.UsersCanViewOnlyOwnRequests, "UsersCanViewOnlyOwnRequests", "Users can only view their own requests")
@Html.Checkbox(Model.BypassRequestLimit, "BypassRequestLimit", "Bypass the request limit")
@Html.Checkbox(Model.ViewUsers, "ViewUsers", "User can see who made requests")

Loading…
Cancel
Save