mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-17 02:49:05 -07:00
19 lines
560 B
C#
19 lines
560 B
C#
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace Jellyfin.Api.Auth.RequiresElevationPolicy
|
|
{
|
|
public class RequiresElevationHandler : AuthorizationHandler<RequiresElevationRequirement>
|
|
{
|
|
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RequiresElevationRequirement requirement)
|
|
{
|
|
if (context.User.IsInRole("Administrator"))
|
|
{
|
|
context.Succeed(requirement);
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|