Ejemplo n.º 1
0
        public PermissionValueProviderManager(
            IServiceProvider serviceProvider,
            IOptions <RocketPermissionOptions> options)
        {
            Options = options.Value;

            _lazyProviders = new Lazy <List <IPermissionValueProvider> > (
                () => Options
                .ValueProviders
                .Select(c => serviceProvider.GetRequiredService(c) as IPermissionValueProvider)
                .ToList(),
                true
                );
        }
Ejemplo n.º 2
0
        public PermissionDefinitionManager(
            IOptions <RocketPermissionOptions> options,
            IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
            Options          = options.Value;

            _lazyPermissionDefinitions = new Lazy <Dictionary <string, PermissionDefinition> > (
                CreatePermissionDefinitions,
                isThreadSafe: true
                );

            _lazyPermissionGroupDefinitions = new Lazy <Dictionary <string, PermissionGroupDefinition> > (
                CreatePermissionGroupDefinitions,
                isThreadSafe: true
                );
        }