mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 10:44:23 -04:00
fix empty user id check for api keys
This commit is contained in:
parent
f984f31896
commit
f4a7583c46
@ -38,9 +38,10 @@ namespace Jellyfin.Api.Auth.DefaultAuthorizationPolicy
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, DefaultAuthorizationRequirement requirement)
|
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, DefaultAuthorizationRequirement requirement)
|
||||||
{
|
{
|
||||||
|
var isApiKey = context.User.GetIsApiKey();
|
||||||
var userId = context.User.GetUserId();
|
var userId = context.User.GetUserId();
|
||||||
// This likely only happens during the wizard, so skip the default checks and let any other handlers do it
|
// This likely only happens during the wizard, so skip the default checks and let any other handlers do it
|
||||||
if (userId.Equals(default))
|
if (!isApiKey && userId.Equals(default))
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -56,7 +57,7 @@ namespace Jellyfin.Api.Auth.DefaultAuthorizationPolicy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Admins can do everything
|
// Admins can do everything
|
||||||
if (context.User.GetIsApiKey() || context.User.IsInRole(UserRoles.Administrator))
|
if (isApiKey || context.User.IsInRole(UserRoles.Administrator))
|
||||||
{
|
{
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user