mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp.Authorization.Permissions;
|
|
using Volo.Abp.Authorization.TestServices;
|
|
using Volo.Abp.Autofac;
|
|
using Volo.Abp.Modularity;
|
|
|
|
namespace Volo.Abp.Authorization
|
|
{
|
|
[DependsOn(typeof(AbpAutofacModule))]
|
|
[DependsOn(typeof(AbpAuthorizationModule))]
|
|
public class AbpAuthorizationTestModule : AbpModule
|
|
{
|
|
public override void PreConfigureServices(IServiceCollection services)
|
|
{
|
|
services.OnRegistred(context =>
|
|
{
|
|
if (typeof(IMyAuthorizedService1).IsAssignableFrom(context.ImplementationType))
|
|
{
|
|
context.Interceptors.TryAdd<AuthorizationInterceptor>();
|
|
}
|
|
});
|
|
}
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.Configure<PermissionOptions>(options =>
|
|
{
|
|
options.DefinitionProviders.TryAdd<AuthorizationTestPermissionDefinitionProvider>();
|
|
});
|
|
|
|
services.AddAssemblyOf<AbpAuthorizationTestModule>();
|
|
}
|
|
}
|
|
} |