public PermissionDefinitionManager( IOptions <PermissionOptions> options, IServiceProvider serviceProvider) { Options = options.Value; _serviceProvider = serviceProvider; _lazyPermissionDefinitions = new Lazy <Dictionary <string, PermissionDefinition> >(CreatePermissionDefinitions, true); _lazyPermissionGroupDefinitions = new Lazy <Dictionary <string, PermissionGroupDefinition> >(CreatePermissionGroupDefinitions, true); }
public PermissionChecker( IOptions <PermissionOptions> options, IServiceProvider serviceProvider, IHttpContextPrincipalAccessor principalAccessor, IPermissionDefinitionManager permissionDefinitionManager) { PrincipalAccessor = principalAccessor; PermissionDefinitionManager = permissionDefinitionManager; Options = options.Value; _lazyProviders = new Lazy <List <IPermissionValueProvider> >(() => Options .ValueProviders .Select(c => serviceProvider.GetRequiredService(c) as IPermissionValueProvider) .ToList(), true); }