mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -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
|
@ -127,7 +127,7 @@ namespace PlexRequests.UI.Helpers
|
|||
|
||||
public bool HasPermissions(IUserIdentity user, Permissions perm)
|
||||
{
|
||||
if (user == null) return false;
|
||||
if (user == null) return false;
|
||||
|
||||
var dbUser = UserRepository.GetUserByUsername(user.UserName);
|
||||
|
||||
|
@ -138,6 +138,27 @@ namespace PlexRequests.UI.Helpers
|
|||
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)
|
||||
{
|
||||
var url = Linker.BuildRelativeUri(context, routeName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue