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 />
|
||||
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, DefaultAuthorizationRequirement requirement)
|
||||
{
|
||||
var isApiKey = context.User.GetIsApiKey();
|
||||
var userId = context.User.GetUserId();
|
||||
// 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;
|
||||
}
|
||||
|
@ -56,7 +57,7 @@ namespace Jellyfin.Api.Auth.DefaultAuthorizationPolicy
|
|||
}
|
||||
|
||||
// Admins can do everything
|
||||
if (context.User.GetIsApiKey() || context.User.IsInRole(UserRoles.Administrator))
|
||||
if (isApiKey || context.User.IsInRole(UserRoles.Administrator))
|
||||
{
|
||||
context.Succeed(requirement);
|
||||
return Task.CompletedTask;
|
||||
|
|
Loading…
Reference in New Issue
Block a user