mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-06-29 10:23:36 +02:00
Simplyfy LocalAccessOrRequiresElevationHandler
This commit is contained in:
parent
c41d95b31b
commit
a68dd94174
|
@ -34,20 +34,9 @@ namespace Jellyfin.Api.Auth.LocalAccessOrRequiresElevationPolicy
|
||||||
var ip = _httpContextAccessor.HttpContext?.GetNormalizedRemoteIP();
|
var ip = _httpContextAccessor.HttpContext?.GetNormalizedRemoteIP();
|
||||||
|
|
||||||
// Loopback will be on LAN, so we can accept null.
|
// Loopback will be on LAN, so we can accept null.
|
||||||
if (ip is null || _networkManager.IsInLocalNetwork(ip))
|
if (ip is null || _networkManager.IsInLocalNetwork(ip) || context.User.IsInRole(UserRoles.Administrator))
|
||||||
{
|
{
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.User.IsInRole(UserRoles.Administrator))
|
|
||||||
{
|
|
||||||
context.Succeed(requirement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context.Fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
Loading…
Reference in a new issue