mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
Remove all references to the claims
This commit is contained in:
parent
7412655c5a
commit
3384ba90fc
8 changed files with 101 additions and 38 deletions
|
@ -58,6 +58,9 @@ namespace PlexRequests.Helpers.Permissions
|
||||||
AutoApproveTv = 128,
|
AutoApproveTv = 128,
|
||||||
|
|
||||||
[Display(Name = "Auto Approve Album Requests")]
|
[Display(Name = "Auto Approve Album Requests")]
|
||||||
AutoApproveAlbum = 256
|
AutoApproveAlbum = 256,
|
||||||
|
|
||||||
|
[Display(Name = "Manage Requests")]
|
||||||
|
ManageRequests = 512
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -127,7 +127,7 @@ namespace PlexRequests.UI.Helpers
|
||||||
|
|
||||||
public bool HasPermissions(IUserIdentity user, Permissions perm)
|
public bool HasPermissions(IUserIdentity user, Permissions perm)
|
||||||
{
|
{
|
||||||
if (user == null) return false;
|
if (user == null) return false;
|
||||||
|
|
||||||
var dbUser = UserRepository.GetUserByUsername(user.UserName);
|
var dbUser = UserRepository.GetUserByUsername(user.UserName);
|
||||||
|
|
||||||
|
@ -138,6 +138,27 @@ namespace PlexRequests.UI.Helpers
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasAnyPermissions(IUserIdentity user, params Permissions[] perm)
|
||||||
|
{
|
||||||
|
if (user == null) return false;
|
||||||
|
|
||||||
|
var dbUser = UserRepository.GetUserByUsername(user.UserName);
|
||||||
|
|
||||||
|
if (dbUser == null) return false;
|
||||||
|
|
||||||
|
var permissions = (Permissions)dbUser.Permissions;
|
||||||
|
foreach (var p in perm)
|
||||||
|
{
|
||||||
|
var result = permissions.HasFlag(p);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public Response HasPermissionsRedirect(Permissions perm, NancyContext context, string routeName, HttpStatusCode code)
|
public Response HasPermissionsRedirect(Permissions perm, NancyContext context, string routeName, HttpStatusCode code)
|
||||||
{
|
{
|
||||||
var url = Linker.BuildRelativeUri(context, routeName);
|
var url = Linker.BuildRelativeUri(context, routeName);
|
||||||
|
|
|
@ -40,6 +40,7 @@ using PlexRequests.Core;
|
||||||
using PlexRequests.Core.Queue;
|
using PlexRequests.Core.Queue;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Permissions;
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
using PlexRequests.UI.Helpers;
|
using PlexRequests.UI.Helpers;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
|
@ -55,6 +56,9 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
||||||
|
|
||||||
|
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
||||||
|
Before += (ctx) => Security.AdminLoginRedirect(Permissions.ManageRequests, ctx);
|
||||||
|
|
||||||
Service = service;
|
Service = service;
|
||||||
CpService = cpService;
|
CpService = cpService;
|
||||||
CpApi = cpApi;
|
CpApi = cpApi;
|
||||||
|
|
|
@ -140,7 +140,6 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
var permissions = (Permissions) user.Permissions;
|
var permissions = (Permissions) user.Permissions;
|
||||||
return permissions.HasFlag(Permissions.Administrator);
|
return permissions.HasFlag(Permissions.Administrator);
|
||||||
// TODO: Check admin role
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ using PlexRequests.Core;
|
||||||
using PlexRequests.Core.Models;
|
using PlexRequests.Core.Models;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Permissions;
|
||||||
using PlexRequests.Services.Interfaces;
|
using PlexRequests.Services.Interfaces;
|
||||||
using PlexRequests.Services.Notification;
|
using PlexRequests.Services.Notification;
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
|
@ -78,7 +79,8 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
foreach (var i in issuesModels)
|
foreach (var i in issuesModels)
|
||||||
{
|
{
|
||||||
var model = new IssuesViewModel { Id = i.Id, RequestId = i.RequestId, Title = i.Title, Type = i.Type.ToString().ToCamelCaseWords(), Admin = IsAdmin };
|
var model = new IssuesViewModel { Id = i.Id, RequestId = i.RequestId, Title = i.Title, Type = i.Type.ToString().ToCamelCaseWords(), Admin = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests)
|
||||||
|
};
|
||||||
|
|
||||||
// Create a string with all of the current issue states with a "," delimiter in e.g. Wrong Content, Playback Issues
|
// Create a string with all of the current issue states with a "," delimiter in e.g. Wrong Content, Playback Issues
|
||||||
var state = i.Issues.Select(x => x.Issue).ToArray();
|
var state = i.Issues.Select(x => x.Issue).ToArray();
|
||||||
|
@ -366,7 +368,11 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to remove an issue." });
|
||||||
|
}
|
||||||
|
|
||||||
var issue = await IssuesService.GetAsync(issueId);
|
var issue = await IssuesService.GetAsync(issueId);
|
||||||
var request = await RequestService.GetAsync(issue.RequestId);
|
var request = await RequestService.GetAsync(issue.RequestId);
|
||||||
if (request.Id > 0)
|
if (request.Id > 0)
|
||||||
|
@ -399,7 +405,11 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return View["Index"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var issue = await IssuesService.GetAsync(issueId);
|
var issue = await IssuesService.GetAsync(issueId);
|
||||||
issue.IssueStatus = status;
|
issue.IssueStatus = status;
|
||||||
|
@ -417,7 +427,11 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Negotiator> ClearIssue(int issueId, IssueState state)
|
private async Task<Negotiator> ClearIssue(int issueId, IssueState state)
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return View["Index"];
|
||||||
|
}
|
||||||
|
|
||||||
var issue = await IssuesService.GetAsync(issueId);
|
var issue = await IssuesService.GetAsync(issueId);
|
||||||
|
|
||||||
var toRemove = issue.Issues.FirstOrDefault(x => x.Issue == state);
|
var toRemove = issue.Issues.FirstOrDefault(x => x.Issue == state);
|
||||||
|
@ -430,7 +444,11 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> AddNote(int requestId, string noteArea, IssueState state)
|
private async Task<Response> AddNote(int requestId, string noteArea, IssueState state)
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to add a note." });
|
||||||
|
}
|
||||||
|
|
||||||
var issue = await IssuesService.GetAsync(requestId);
|
var issue = await IssuesService.GetAsync(requestId);
|
||||||
if (issue == null)
|
if (issue == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,6 @@ using PlexRequests.Services.Notification;
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
using PlexRequests.UI.Models;
|
using PlexRequests.UI.Models;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
using PlexRequests.UI.Helpers;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PlexRequests.Api.Interfaces;
|
using PlexRequests.Api.Interfaces;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -48,7 +47,7 @@ using NLog;
|
||||||
|
|
||||||
using PlexRequests.Core.Models;
|
using PlexRequests.Core.Models;
|
||||||
using PlexRequests.Helpers.Analytics;
|
using PlexRequests.Helpers.Analytics;
|
||||||
|
using PlexRequests.Helpers.Permissions;
|
||||||
using Action = PlexRequests.Helpers.Analytics.Action;
|
using Action = PlexRequests.Helpers.Analytics.Action;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
|
@ -157,6 +156,8 @@ namespace PlexRequests.UI.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests);
|
||||||
var viewModel = dbMovies.Select(movie => new RequestViewModel
|
var viewModel = dbMovies.Select(movie => new RequestViewModel
|
||||||
{
|
{
|
||||||
ProviderId = movie.ProviderId,
|
ProviderId = movie.ProviderId,
|
||||||
|
@ -173,10 +174,10 @@ namespace PlexRequests.UI.Modules
|
||||||
Approved = movie.Available || movie.Approved,
|
Approved = movie.Available || movie.Approved,
|
||||||
Title = movie.Title,
|
Title = movie.Title,
|
||||||
Overview = movie.Overview,
|
Overview = movie.Overview,
|
||||||
RequestedUsers = IsAdmin ? movie.AllUsers.ToArray() : new string[] { },
|
RequestedUsers = canManageRequest ? movie.AllUsers.ToArray() : new string[] { },
|
||||||
ReleaseYear = movie.ReleaseDate.Year.ToString(),
|
ReleaseYear = movie.ReleaseDate.Year.ToString(),
|
||||||
Available = movie.Available,
|
Available = movie.Available,
|
||||||
Admin = IsAdmin,
|
Admin = canManageRequest,
|
||||||
IssueId = movie.IssueId,
|
IssueId = movie.IssueId,
|
||||||
Denied = movie.Denied,
|
Denied = movie.Denied,
|
||||||
DeniedReason = movie.DeniedReason,
|
DeniedReason = movie.DeniedReason,
|
||||||
|
@ -230,6 +231,7 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests);
|
||||||
var viewModel = dbTv.Select(tv => new RequestViewModel
|
var viewModel = dbTv.Select(tv => new RequestViewModel
|
||||||
{
|
{
|
||||||
ProviderId = tv.ProviderId,
|
ProviderId = tv.ProviderId,
|
||||||
|
@ -246,10 +248,10 @@ namespace PlexRequests.UI.Modules
|
||||||
Approved = tv.Available || tv.Approved,
|
Approved = tv.Available || tv.Approved,
|
||||||
Title = tv.Title,
|
Title = tv.Title,
|
||||||
Overview = tv.Overview,
|
Overview = tv.Overview,
|
||||||
RequestedUsers = IsAdmin ? tv.AllUsers.ToArray() : new string[] { },
|
RequestedUsers = canManageRequest ? tv.AllUsers.ToArray() : new string[] { },
|
||||||
ReleaseYear = tv.ReleaseDate.Year.ToString(),
|
ReleaseYear = tv.ReleaseDate.Year.ToString(),
|
||||||
Available = tv.Available,
|
Available = tv.Available,
|
||||||
Admin = IsAdmin,
|
Admin = canManageRequest,
|
||||||
IssueId = tv.IssueId,
|
IssueId = tv.IssueId,
|
||||||
Denied = tv.Denied,
|
Denied = tv.Denied,
|
||||||
DeniedReason = tv.DeniedReason,
|
DeniedReason = tv.DeniedReason,
|
||||||
|
@ -270,7 +272,7 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
dbAlbum = dbAlbum.Where(x => x.UserHasRequested(Username));
|
dbAlbum = dbAlbum.Where(x => x.UserHasRequested(Username));
|
||||||
}
|
}
|
||||||
|
var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests);
|
||||||
var viewModel = dbAlbum.Select(album =>
|
var viewModel = dbAlbum.Select(album =>
|
||||||
{
|
{
|
||||||
return new RequestViewModel
|
return new RequestViewModel
|
||||||
|
@ -289,10 +291,10 @@ namespace PlexRequests.UI.Modules
|
||||||
Approved = album.Available || album.Approved,
|
Approved = album.Available || album.Approved,
|
||||||
Title = album.Title,
|
Title = album.Title,
|
||||||
Overview = album.Overview,
|
Overview = album.Overview,
|
||||||
RequestedUsers = IsAdmin ? album.AllUsers.ToArray() : new string[] { },
|
RequestedUsers = canManageRequest ? album.AllUsers.ToArray() : new string[] { },
|
||||||
ReleaseYear = album.ReleaseDate.Year.ToString(),
|
ReleaseYear = album.ReleaseDate.Year.ToString(),
|
||||||
Available = album.Available,
|
Available = album.Available,
|
||||||
Admin = IsAdmin,
|
Admin = canManageRequest,
|
||||||
IssueId = album.IssueId,
|
IssueId = album.IssueId,
|
||||||
Denied = album.Denied,
|
Denied = album.Denied,
|
||||||
DeniedReason = album.DeniedReason,
|
DeniedReason = album.DeniedReason,
|
||||||
|
@ -308,7 +310,12 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> DeleteRequest(int requestid)
|
private async Task<Response> DeleteRequest(int requestid)
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Analytics.TrackEventAsync(Category.Requests, Action.Delete, "Delete Request", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
Analytics.TrackEventAsync(Category.Requests, Action.Delete, "Delete Request", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||||
|
|
||||||
var currentEntity = await Service.GetAsync(requestid);
|
var currentEntity = await Service.GetAsync(requestid);
|
||||||
|
@ -326,6 +333,10 @@ namespace PlexRequests.UI.Modules
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<Response> ReportIssue(int requestId, IssueState issue, string comment)
|
private async Task<Response> ReportIssue(int requestId, IssueState issue, string comment)
|
||||||
{
|
{
|
||||||
|
if (!Security.HasPermissions(User, Permissions.ReportIssue))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to report an issue." });
|
||||||
|
}
|
||||||
var originalRequest = await Service.GetAsync(requestId);
|
var originalRequest = await Service.GetAsync(requestId);
|
||||||
if (originalRequest == null)
|
if (originalRequest == null)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +367,10 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> ClearIssue(int requestId)
|
private async Task<Response> ClearIssue(int requestId)
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to clear an issue." });
|
||||||
|
}
|
||||||
|
|
||||||
var originalRequest = await Service.GetAsync(requestId);
|
var originalRequest = await Service.GetAsync(requestId);
|
||||||
if (originalRequest == null)
|
if (originalRequest == null)
|
||||||
|
@ -374,7 +388,11 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> ChangeRequestAvailability(int requestId, bool available)
|
private async Task<Response> ChangeRequestAvailability(int requestId, bool available)
|
||||||
{
|
{
|
||||||
this.RequiresAnyClaim(UserClaims.Admin, UserClaims.PowerUser);
|
if (!Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests))
|
||||||
|
{
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sorry, you do not have the correct permissions to change a request." });
|
||||||
|
}
|
||||||
|
|
||||||
Analytics.TrackEventAsync(Category.Requests, Action.Update, available ? "Make request available" : "Make request unavailable", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
Analytics.TrackEventAsync(Category.Requests, Action.Update, available ? "Make request available" : "Make request unavailable", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||||
var originalRequest = await Service.GetAsync(requestId);
|
var originalRequest = await Service.GetAsync(requestId);
|
||||||
if (originalRequest == null)
|
if (originalRequest == null)
|
||||||
|
|
|
@ -465,7 +465,7 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> RequestMovie(int movieId)
|
private async Task<Response> RequestMovie(int movieId)
|
||||||
{
|
{
|
||||||
if (Security.DoesNotHavePermissions(Permissions.ReadOnlyUser, User))
|
if (Security.HasPermissions(User, Permissions.ReadOnlyUser) || !Security.HasPermissions(User, Permissions.RequestMovie))
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel
|
Response.AsJson(new JsonResponseModel
|
||||||
|
@ -616,7 +616,7 @@ namespace PlexRequests.UI.Modules
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<Response> RequestTvShow(int showId, string seasons)
|
private async Task<Response> RequestTvShow(int showId, string seasons)
|
||||||
{
|
{
|
||||||
if (Security.HasPermissions(User, Permissions.ReadOnlyUser))
|
if (Security.HasPermissions(User, Permissions.ReadOnlyUser) || !Security.HasPermissions(User, Permissions.RequestTvShow))
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel()
|
Response.AsJson(new JsonResponseModel()
|
||||||
|
@ -977,14 +977,11 @@ namespace PlexRequests.UI.Modules
|
||||||
var sendNotification = type.ShouldAutoApprove(prSettings, IsAdmin, Username)
|
var sendNotification = type.ShouldAutoApprove(prSettings, IsAdmin, Username)
|
||||||
? !prSettings.IgnoreNotifyForAutoApprovedRequests
|
? !prSettings.IgnoreNotifyForAutoApprovedRequests
|
||||||
: true;
|
: true;
|
||||||
var claims = Context.CurrentUser?.Claims;
|
|
||||||
if (claims != null)
|
if (IsAdmin)
|
||||||
{
|
{
|
||||||
var enumerable = claims as string[] ?? claims.ToArray();
|
sendNotification = false; // Don't bother sending a notification if the user is an admin
|
||||||
if (enumerable.Contains(UserClaims.Admin) || enumerable.Contains(UserClaims.PowerUser))
|
|
||||||
{
|
|
||||||
sendNotification = false; // Don't bother sending a notification if the user is an admin
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return sendNotification;
|
return sendNotification;
|
||||||
}
|
}
|
||||||
|
@ -992,6 +989,16 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private async Task<Response> RequestAlbum(string releaseId)
|
private async Task<Response> RequestAlbum(string releaseId)
|
||||||
{
|
{
|
||||||
|
if (Security.HasPermissions(User, Permissions.ReadOnlyUser) || !Security.HasPermissions(User, Permissions.RequestMusic))
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Response.AsJson(new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = false,
|
||||||
|
Message = "Sorry, you do not have the correct permissions to request music!"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var settings = await PrService.GetSettingsAsync();
|
var settings = await PrService.GetSettingsAsync();
|
||||||
if (!await CheckRequestLimit(settings, RequestType.Album))
|
if (!await CheckRequestLimit(settings, RequestType.Album))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
@using System.Linq
|
@using System.Linq
|
||||||
@using PlexRequests.Core.Models
|
@using PlexRequests.Core.Models
|
||||||
@using PlexRequests.Helpers
|
@using PlexRequests.Helpers
|
||||||
|
@using PlexRequests.Helpers.Permissions
|
||||||
@using PlexRequests.UI.Helpers
|
@using PlexRequests.UI.Helpers
|
||||||
@{
|
@{
|
||||||
var baseUrl = Html.GetBaseUrl();
|
var baseUrl = Html.GetBaseUrl();
|
||||||
|
@ -10,16 +11,8 @@
|
||||||
formAction = "/" + baseUrl.ToHtmlString();
|
formAction = "/" + baseUrl.ToHtmlString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var isAdmin = false;
|
var isAdmin = Html.HasAnyPermission((int)Permissions.Administrator) || Html.HasAnyPermission((int)Permissions.ManageRequests);
|
||||||
|
|
||||||
if (Context.CurrentUser != null)
|
|
||||||
{
|
|
||||||
var claims = Context.CurrentUser.Claims.ToList();
|
|
||||||
if (claims.Contains("Admin") || claims.Contains("PowerUser"))
|
|
||||||
{
|
|
||||||
isAdmin = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
<h1>Details</h1>
|
<h1>Details</h1>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue