using System.Threading.Tasks;
using Jellyfin.Api.Constants;
using Microsoft.AspNetCore.Authorization;
namespace Jellyfin.Api.Auth.RequiresElevationPolicy
{
///
/// Authorization handler for requiring elevated privileges.
///
public class RequiresElevationHandler : AuthorizationHandler
{
///
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RequiresElevationRequirement requirement)
{
if (context.User.IsInRole(UserRoles.Administrator))
{
context.Succeed(requirement);
}
return Task.CompletedTask;
}
}
}