2021-12-19 13:44:22 +00:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2021-11-29 21:04:15 +00:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-06-22 08:01:59 +01:00
|
|
|
|
using Selector.Cache;
|
2021-11-29 21:04:15 +00:00
|
|
|
|
using Selector.Model.Authorisation;
|
|
|
|
|
|
|
|
|
|
namespace Selector.Model.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class ServiceExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AddAuthorisationHandlers(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddScoped<IAuthorizationHandler, WatcherIsOwnerAuthHandler>();
|
|
|
|
|
services.AddSingleton<IAuthorizationHandler, WatcherIsAdminAuthHandler>();
|
|
|
|
|
|
|
|
|
|
services.AddScoped<IAuthorizationHandler, UserIsSelfAuthHandler>();
|
|
|
|
|
services.AddSingleton<IAuthorizationHandler, UserIsAdminAuthHandler>();
|
|
|
|
|
}
|
2022-06-22 08:01:59 +01:00
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddDBPlayCountPuller(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddTransient<DBPlayCountPuller>();
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
2021-11-29 21:04:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|