public void Setup()
        {
            Effort.Provider.EffortProviderConfiguration.RegisterProvider();

            var connection = DbConnectionFactory.CreateTransient();
            _context = new ApplicationDbContext(connection);
            _context.GenerateRandomData();

            _resolver = new HostNameTenantResolver(new List<ITenant>
            {
                new Tenant(1, "local", "localhost"),
                new Tenant(2, "sample", "sample.local")
            }, "TenantId");

            _server = TestServer.Create(app =>
            {
                app.UseTenantCore(_resolver);

                app.Run(context =>
                {
                    var tenant = context.GetCurrentTenant();

                    return context.Response.WriteAsync(tenant.Name);
                });
            });
        }
 public RequestTimeZoneIdResolver(
     IHttpContextAccessor contextAccessor,
     ITenantResolver<SiteContext> siteResolver,
     SiteUserManager<SiteUser> userManager
     )
 {
     this.contextAccessor = contextAccessor;
     this.siteResolver = siteResolver;
     this.userManager = userManager;
 }
 public MultiTenantOAuthOptionsResolver(
     //ISiteResolver siteResolver,
     IHttpContextAccessor contextAccessor,
     ITenantResolver<SiteSettings> siteResolver,
     MultiTenantOptions multiTenantOptions)
 {
     this.siteResolver = siteResolver;
     this.contextAccessor = contextAccessor;
     //site = currentSite;
     this.multiTenantOptions = multiTenantOptions;
 }
 public MultiTenantAuthCookieValidator(
     IHttpContextAccessor contextAccessor,
     ITenantResolver<SiteSettings> siteResolver,
     ISecurityStampValidator securityStampValidator,
     ILogger<MultiTenantAuthCookieValidator> logger
     )
 {
     this.contextAccessor = contextAccessor;
     this.securityStampValidator = securityStampValidator;
     this.siteResolver = siteResolver;
     log = logger;
 }
 public UserController(IUserRepository users, IRoleRepository roles, IUserRoleRepository userRoles, UserManager <IdentityUser> identityUserManager, SignInManager <IdentityUser> identitySignInManager, ITenantResolver tenants, INotificationRepository notifications, IFolderRepository folders, ISyncManager syncManager, ISiteRepository sites, ILogManager logger)
 {
     _users                 = users;
     _roles                 = roles;
     _userRoles             = userRoles;
     _identityUserManager   = identityUserManager;
     _identitySignInManager = identitySignInManager;
     _tenants               = tenants;
     _folders               = folders;
     _notifications         = notifications;
     _syncManager           = syncManager;
     _sites                 = sites;
     _logger                = logger;
 }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="environment"></param>
        /// <returns></returns>
        public async Task Invoke(IDictionary <string, object> environment)
        {
            Ensure.Argument.NotNull(environment, nameof(environment));

            ITenantResolver <TTenant> tenantResolver = _tenantResolverFactory();
            TenantContext <TTenant>   tenantContext  = await tenantResolver.ResolveAsync(environment);

            if (tenantContext != null)
            {
                environment.SetTenantContext(tenantContext);
            }

            await _next(environment);
        }
Beispiel #7
0
        //private string requiredSiteFolder;

        //public SiteFolderRouteConstraint(string folderParam)
        //{
        //    requiredSiteFolder = folderParam;
        //}

        //TODO: is this getting called on requests for static resources?
        // want to make sure it is not, we don't want to hit the db on requests for static files

        public bool Match(
            HttpContext httpContext,
            IRouter route,
            string parameterName,
            IDictionary <string, object> values,
            RouteDirection routeDirection)
        {
            // TODO: problem here is we want to make this method be async
            //https://github.com/aspnet/Mvc/issues/1094
            // but may have to jump through some hoops
            // for now we are calling an async method synchronously while blocking the thread

            string requestFolder = httpContext.Request.Path.StartingSegment();
            //return string.Equals(requiredSiteFolder, requestFolder, StringComparison.CurrentCultureIgnoreCase);
            ITenantResolver <SiteSettings> siteResolver
                = httpContext.ApplicationServices.GetService <ITenantResolver <SiteSettings> >();

            if (siteResolver != null)
            {
                try
                {
                    // exceptions expected here until db install scripts have run or if db connection error
                    //ISiteSettings site = siteResolver.Resolve();
                    //var siteContext = Task.Run<TenantContext<SiteSettings>>(fun => siteResolver.ResolveAsync(httpContext));
                    //

                    Func <Task <TenantContext <SiteSettings> > > f = delegate()
                    {
                        return(siteResolver.ResolveAsync(httpContext));
                    };

                    //http://stackoverflow.com/questions/22628087/calling-async-method-synchronously
                    var siteContext = Task.Run <TenantContext <SiteSettings> >(f).Result;

                    if ((siteContext != null) &&
                        (siteContext.Tenant != null) &&
                        (siteContext.Tenant.SiteFolderName == requestFolder))
                    {
                        return(true);
                    }
                }
                catch
                {
                    // do we need to log this?
                }
            }

            return(false);
        }
Beispiel #8
0
        /// <summary>
        /// Add TenantCore to an AppBuilder
        /// </summary>
        /// <param name="app">The AppBuilder instance</param>
        /// <param name="resolver">The Tenant Resolver instance</param>
        /// <param name="callback">The callback method</param>
        /// <returns>AppBuilder with TenantCore</returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static IAppBuilder UseTenantCore(this IAppBuilder app, ITenantResolver resolver,
                                                Func <ITenant, bool> callback = null)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (resolver == null)
            {
                throw new ArgumentNullException(nameof(resolver));
            }

            return(app.Use(typeof(TenantCoreMiddleware), resolver, callback));
        }
        public async Task Invoke(HttpContext ctx, ITenantResolver tenantResolver, DatabaseContext db)
        {
            var host   = ctx.Request.GetTypedHeaders().Host.Value;
            var tenant = await tenantResolver.Resolve(host);

            if (tenant == null)
            {
                throw new Exception("Tenant not found");
            }
            else
            {
                db.SetActiveTenant(tenant);
                await Next(ctx);
            }
        }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of <see cref="CommandCoordinator"/>
 /// </summary>
 /// <param name="commandCoordinator">The underlying <see cref="ICommandCoordinator"/> </param>
 /// <param name="executionContextConfigurator"><see cref="IExecutionContextConfigurator"/> for configuring the <see cref="Dolittle.Execution.ExecutionContext"/></param>
 /// <param name="tenantResolver"></param>
 /// <param name="serializer"><see cref="ISerializer"/> for serialization purposes</param>
 /// <param name="commands">Instances of <see cref="ICommand"/></param>
 /// <param name="logger"></param>
 public CommandCoordinator(
     ICommandCoordinator commandCoordinator,
     IExecutionContextConfigurator executionContextConfigurator,
     ITenantResolver tenantResolver,
     ISerializer serializer,
     IInstancesOf <ICommand> commands,
     ILogger logger
     )
 {
     _commandCoordinator           = commandCoordinator;
     _commands                     = commands;
     _serializer                   = serializer;
     _executionContextConfigurator = executionContextConfigurator;
     _tenantResolver               = tenantResolver;
     _logger = logger;
 }
Beispiel #11
0
 public ContactFormProcessor(
     ViewRenderer viewRenderer,
     ITenantResolver tenantResolver,
     IEmailSenderResolver emailSenderResolver,
     IContactFormResolver contactFormResolver,
     IOptions <ContactFormMessageOptions> messageProcessorOptionsAccessor,
     ILogger <ContactFormProcessor> logger
     )
 {
     _viewRenderer            = viewRenderer;
     _tenantResolver          = tenantResolver;
     _emailSenderResolver     = emailSenderResolver;
     _contactFormResolver     = contactFormResolver;
     _messageProcessorOptions = messageProcessorOptionsAccessor.Value;
     _log = logger;
 }
Beispiel #12
0
        public MultiTenantTwitterHandler(
            HttpClient httpClient,
            //ISiteResolver siteResolver,
            IHttpContextAccessor contextAccessor,
            ITenantResolver <SiteSettings> siteResolver,
            ISiteRepository siteRepository,
            MultiTenantOptions multiTenantOptions,
            ILoggerFactory loggerFactory)
        {
            _httpClient = httpClient;

            log = loggerFactory.CreateLogger <MultiTenantTwitterHandler>();
            this.contextAccessor    = contextAccessor;
            this.siteResolver       = siteResolver;
            this.multiTenantOptions = multiTenantOptions;
            siteRepo = siteRepository;
        }
#pragma warning disable UseAsyncSuffix // Use Async suffix
        public async Task Invoke(HttpContext httpContext, ITenantResolver tenantResolver, ITenantProvider tenantProvider)
#pragma warning restore UseAsyncSuffix // Use Async suffix
        {
            var tenant = tenantResolver.ResolveTenant(httpContext);

            if (string.IsNullOrEmpty(tenant))
            {
                // Call the next middleware delegate in the pipeline
                await _next.Invoke(httpContext);
            }
            else
            {
                using (tenantProvider.BeginScope(tenant))
                {
                    await _next.Invoke(httpContext);
                }
            }
        }
        public async Task Invoke(HttpContext context, ITenantResolver tenantResolver)
        {
            if (context.Request.RouteValues.ContainsKey(RouteValueKey))
            {
                var tenant = tenantResolver.Resolve();

                var user = context.User;
                if (!UserHasPermissionForTenant(tenant, user))
                {
                    context.Response.StatusCode = 401;
                    await context.Response.WriteAsync($"You do not have permission to access '{tenant}'.");

                    return;
                }
            }

            await _next.Invoke(context);
        }
        public async Task Invoke(HttpContext context, ITenantResolver <TTenant> tenantResolver)
        {
            log.LogDebug("Resolving TenantContext using {loggerType}.", tenantResolver.GetType().Name);

            var tenantContext = await tenantResolver.Resolve(context);

            if (tenantContext != null)
            {
                log.LogDebug("TenantContext Resolved. Adding to HttpContext.");
                context.SetTenantContext(tenantContext);
            }
            else
            {
                log.LogDebug("TenantContext Not Resolved.");
            }

            await next.Invoke(context);
        }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of <see cref="QueryCoordinator"/>
 /// </summary>
 /// <param name="typeFinder"></param>
 /// <param name="container"></param>
 /// <param name="queryCoordinator">The underlying <see cref="IQueryCoordinator"/> </param>
 /// <param name="executionContextConfigurator"></param>
 /// <param name="tenantResolver"></param>
 /// <param name="queries"></param>
 /// <param name="serializer"></param>
 /// <param name="logger"></param>
 public QueryCoordinator(
     ITypeFinder typeFinder,
     IContainer container,
     IQueryCoordinator queryCoordinator,
     IExecutionContextConfigurator executionContextConfigurator,
     ITenantResolver tenantResolver,
     IInstancesOf <IQuery> queries,
     ISerializer serializer,
     ILogger logger)
 {
     _typeFinder                   = typeFinder;
     _container                    = container;
     _queryCoordinator             = queryCoordinator;
     _executionContextConfigurator = executionContextConfigurator;
     _tenantResolver               = tenantResolver;
     _queries    = queries;
     _serializer = serializer;
     _logger     = logger;
 }
Beispiel #17
0
 public MultiTenantMicrosoftAccountHandler(
     HttpClient httpClient,
     //ISiteResolver siteResolver,
     IHttpContextAccessor contextAccessor,
     ITenantResolver <SiteSettings> siteResolver,
     ISiteRepository siteRepository,
     MultiTenantOptions multiTenantOptions,
     ILoggerFactory loggerFactory)
     : base(
         httpClient,
         loggerFactory,
         new MultiTenantOAuthOptionsResolver(contextAccessor, siteResolver, multiTenantOptions)
         )
 {
     log = loggerFactory.CreateLogger <MultiTenantMicrosoftAccountHandler>();
     this.contextAccessor    = contextAccessor;
     this.siteResolver       = siteResolver;
     this.multiTenantOptions = multiTenantOptions;
     siteRepo = siteRepository;
 }
Beispiel #18
0
        public async Task Invoke(HttpContext context, ITenantResolver tenantResolver)
        {
            logger.LogDebug("Resolving TenantContext using {loggerType}.", tenantResolver.GetType().Name);

            var tenantContext = await tenantResolver.ResolveAsync(context);

            if (tenantContext != null)
            {
                logger.LogDebug("TenantContext resolved successful. Adding to HttpContext.");
                context.SetTenantContext(tenantContext);
            }
            else if (tenantsConfig.UnresolvedRedirect.HasValue())
            {
                logger.LogDebug("TenantContext resolved failure. Now redreact to unresolved url.");
                Redirect(context, tenantsConfig.UnresolvedRedirect, tenantsConfig.RedirectPermanent);
                return;
            }

            await next.Invoke(context);
        }
Beispiel #19
0
        public async Task Invoke(HttpContext context, ITenantResolver <TTenant> tenantResolver)
        {
            Ensure.Argument.NotNull(context, nameof(context));
            Ensure.Argument.NotNull(tenantResolver, nameof(tenantResolver));

            log.LogDebug("Resolving TenantContext using {loggerType}.", tenantResolver.GetType().Name);

            var tenantContext = await tenantResolver.ResolveAsync(context);

            if (tenantContext != null)
            {
                log.LogVerbose("TenantContext Resolved. Adding to HttpContext.");
                context.SetTenantContext(tenantContext);
            }
            else
            {
                log.LogDebug("TenantContext Not Resolved.");
            }

            await next.Invoke(context);
        }
Beispiel #20
0
        /// <summary>
        /// creates a httpcontxt with an authenticated user
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public ControllerContext BuildHttpContext(string userName)
        {
            if (!app.Started)
            {
                throw new System.InvalidOperationException("The test environmnet has not been started yet. call app.Start(...) before calling this method.");
            }

            var httpCtxMock = new Mock <HttpContextBase>();

            ITenantResolver tenantResolver = IoCFactory.Container.Resolve <ITenantResolver>();
            var             tenant         = tenantResolver.DefaultTenant;

            // setting the landing page for the current session
            GeneralSettings generalSettings = IoCFactory.Container.Resolve <GeneralSettings>();
            var             landingPage     = generalSettings.GetEntryValue("landingPage").ToString();

            tenant.LandingPage = landingPage; // checks and sets

            var httpSessionMock = new Mock <HttpSessionStateBase>();

            httpSessionMock.Setup(x => x["CurrentTenant"]).Returns(tenant);
            httpCtxMock.Setup(ctx => ctx.Session).Returns(httpSessionMock.Object);

            if (!string.IsNullOrWhiteSpace(userName))
            {
                var validPrincipal = new ClaimsPrincipal(
                    new[]
                {
                    new ClaimsIdentity(
                        new[] { new Claim(ClaimTypes.NameIdentifier, userName) })
                });
                httpCtxMock.Setup(ctx => ctx.User).Returns(validPrincipal);
            }

            ControllerContext controllerCtx = new ControllerContext();

            controllerCtx.HttpContext = httpCtxMock.Object;
            return(controllerCtx);
        }
Beispiel #21
0
        /// <summary>
        /// Initializes a new <see cref="GoogleAuthenticationMiddleware"/>.
        /// </summary>
        /// <param name="next">The next middleware in the HTTP pipeline to invoke.</param>
        /// <param name="dataProtectionProvider"></param>
        /// <param name="loggerFactory"></param>
        /// <param name="encoder"></param>
        /// <param name="sharedOptions"></param>
        /// <param name="options">Configuration options for the middleware.</param>
        /// <param name="configureOptions"></param>
        public MultiTenantGoogleMiddleware(
            RequestDelegate next,
            IDataProtectionProvider dataProtectionProvider,
            ILoggerFactory loggerFactory,
            IHttpContextAccessor contextAccessor,
            ITenantResolver <SiteSettings> siteResolver,
            ISiteRepository siteRepository,
            IOptions <MultiTenantOptions> multiTenantOptionsAccesor,
            IUrlEncoder encoder,
            IOptions <SharedAuthenticationOptions> sharedOptions,
            GoogleOptions options)
            : base(
                next,
                dataProtectionProvider,
                contextAccessor,
                loggerFactory,
                encoder,
                siteResolver,
                multiTenantOptionsAccesor,
                sharedOptions,
                options)
        {
            if (Options.Scope.Count == 0)
            {
                // Google OAuth 2.0 asks for non-empty scope. If user didn't set it, set default scope to
                // "openid profile email" to get basic user information.
                // TODO: Should we just add these by default when we create the Options?
                Options.Scope.Add("openid");
                Options.Scope.Add("profile");
                Options.Scope.Add("email");
            }

            this.loggerFactory   = loggerFactory;
            this.contextAccessor = contextAccessor;
            this.siteResolver    = siteResolver;
            multiTenantOptions   = multiTenantOptionsAccesor.Value;
            siteRepo             = siteRepository;
        }
Beispiel #22
0
 public StatefulControllerDependencies(IZoneMapper zoneMapper,
                                       ITenantResolver tenantResolver,
                                       IUserResolver userResolver,
                                       //IModuleDefinitionRepository moduleDefinitionRepository,
                                       IModuleRepository moduleRepository,
                                       //ISettingRepository settingRepository,
                                       //OqtaneContainer oqtaneContainer,
                                       OqtTempInstanceContext oqtTempInstanceContext,
                                       IServiceProvider serviceProvider,
                                       IContextResolver ctxResolver
                                       )
 {
     ServiceProvider = serviceProvider;
     CtxResolver     = ctxResolver;
     ZoneMapper      = zoneMapper;
     TenantResolver  = tenantResolver;
     UserResolver    = userResolver;
     //ModuleDefinitionRepository = moduleDefinitionRepository;
     ModuleRepository = moduleRepository;
     //SettingRepository = settingRepository;
     //_oqtaneContainer = oqtaneContainer;
     OqtTempInstanceContext = oqtTempInstanceContext;
 }
        public async Task Invoke(
            HttpContext httpContext,
            ILog <TenantResolutionMiddleware <TTenant> > logger,
            ITenantResolver <TTenant> tenantResolver)
        {
            logger?.Debug($"Resolving TenantContext using {tenantResolver.GetType().Name}.");
            TenantContext <TTenant> tenantContext = await tenantResolver.ResolveAsync(httpContext).ConfigureAwait(false);

            if (tenantContext != null)
            {
                logger?.Debug("TenantContext Resolved. Adding to HttpContext.");
                httpContext?.SetTenantContext(tenantContext);
            }
            else
            {
                logger?.Warn("TenantContext Not Resolved.");
            }

            //using (logger.Info($"Tenant:{httpContext.GetTenant<TTenant>()}"))
            {
                await next.Invoke(httpContext).ConfigureAwait(false);
            }
        }
#pragma warning disable UseAsyncSuffix // Use Async suffix
        public async Task Invoke(HttpContext httpContext, ITenantResolver tenantResolver, ITenantProvider tenantProvider)
#pragma warning restore UseAsyncSuffix // Use Async suffix
        {
            var tenant = tenantResolver.ResolveTenant(httpContext);

            if (string.IsNullOrEmpty(tenant))
            {
                // Call the next middleware delegate in the pipeline
                await _next.Invoke(httpContext);
            }
            else
            {
                var tenantContainerProvider = (ITenantContainerProvider)httpContext.RequestServices.GetService(typeof(ITenantContainerProvider));
                var tenantContainer         = tenantContainerProvider.GetTenantContainer(tenant);
                using (var scopedConatiner = tenantContainer.OpenScope(Reuse.WebRequestScopeName))
                {
                    // replace the RequestScope container by the tenant request scope
                    httpContext.RequestServices = scopedConatiner.Resolve <IServiceProvider>();

                    // Call the next middleware delegate in the pipeline
                    await _next.Invoke(httpContext);
                }
            }
        }
        public async Task Invoke(HttpContext context, ITenantResolver resolver, IConfiguration configuration,
                                 IServiceProvider provider)
        {
            Guard.ArgumentNotNull(context, nameof(context));
            Guard.ArgumentNotNull(resolver, nameof(resolver));
            Guard.ArgumentNotNull(configuration, nameof(configuration));

            _logger.LogDebug("Resolving Tenant using {loggerType}.", resolver.GetType().Name);

            var tenant = await resolver.ResolveAsync(context);

            if (tenant != null)
            {
                _logger.LogDebug("Tenant Resolved. Adding to HttpContext.");

                context.SetTenantContext(new TenantContext(tenant));
            }
            else
            {
                _logger.LogDebug("Tenant Not Resolved.");
            }

            await _next.Invoke(context);
        }
Beispiel #26
0
        protected void Application_Start()
        {
            IoCFactory.StartContainer(Path.Combine(AppConfiguration.AppRoot, "IoC.config"), "DefaultContainer", HttpContext.Current); // use AppConfig to access the app root folder
            //loadModules();
            IPersistenceManager pManager = PersistenceFactory.GetPersistenceManager();                                                // just to prepare data access environment

            pManager.Configure(AppConfiguration.DefaultApplicationConnection.ConnectionString, AppConfiguration.DatabaseDialect);     //, AppConfiguration.DefaultApplicationConnection.ConnectionString);
            if (AppConfiguration.CreateDatabase)
            {
                pManager.ExportSchema();
            }
            pManager.Start();

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            ITenantResolver     tenantResolver = IoCFactory.Container.Resolve <ITenantResolver>();
            ITenantPathProvider pathProvider   = new DefaultTenantPathProvider(); // should be instantiated by the IoC. client app should provide the Path Ptovider based on its file and tenant structure

            tenantResolver.Load(pathProvider);
            var x = tenantResolver.Manifest;
        }
Beispiel #27
0
 public MultiTenantFacebookMiddleware(
     RequestDelegate next,
     IDataProtectionProvider dataProtectionProvider,
     ILoggerFactory loggerFactory,
     //ISiteResolver siteResolver,
     IHttpContextAccessor contextAccessor,
     ITenantResolver <SiteSettings> siteResolver,
     ISiteRepository siteRepository,
     IOptions <MultiTenantOptions> multiTenantOptionsAccesor,
     IUrlEncoder encoder,
     IOptions <SharedAuthenticationOptions> sharedOptions,
     FacebookOptions options)
     : base(next,
            dataProtectionProvider,
            contextAccessor,
            loggerFactory,
            encoder,
            siteResolver,
            multiTenantOptionsAccesor,
            sharedOptions,
            options)
 {
     //if (string.IsNullOrEmpty(Options.AppId))
     //{
     //    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.Exception_OptionMustBeProvided, nameof(Options.AppId)));
     //}
     //if (string.IsNullOrEmpty(Options.AppSecret))
     //{
     //    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.Exception_OptionMustBeProvided, nameof(Options.AppSecret)));
     //}
     this.loggerFactory   = loggerFactory;
     this.contextAccessor = contextAccessor;
     this.siteResolver    = siteResolver;
     multiTenantOptions   = multiTenantOptionsAccesor.Value;
     siteRepo             = siteRepository;
 }
 public ReportViewerContext(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
 {
     // ContextBase handles multi-tenant database connections
 }
Beispiel #29
0
 public HtmlTextContext(ITenantResolver TenantResolver, IHttpContextAccessor accessor) : base(TenantResolver, accessor)
 {
     // ContextBase handles multi-tenant database connections
 }
Beispiel #30
0
        public CronusContextFactory(CronusContext context, IOptionsMonitor <TenantsOptions> tenantsOptions, ITenantResolver tenantResolver)
        {
            this.context        = context;
            this.tenantResolver = tenantResolver;

            this.tenants = tenantsOptions.CurrentValue;
        }
 public FileController(IWebHostEnvironment environment, IFileRepository files, IFolderRepository folders, IUserPermissions userPermissions, ITenantResolver tenants, ILogManager logger)
 {
     _environment     = environment;
     _files           = files;
     _folders         = folders;
     _userPermissions = userPermissions;
     _tenants         = tenants;
     _logger          = logger;
 }
 public PageModuleController(IPageModuleRepository pageModules, IUserPermissions userPermissions, ITenantResolver tenants, ISyncManager syncManager, ILogManager logger)
 {
     _pageModules     = pageModules;
     _userPermissions = userPermissions;
     _tenants         = tenants;
     _syncManager     = syncManager;
     _logger          = logger;
 }
 public ModuleController(IModuleRepository modules, IPageModuleRepository pageModules, IPageRepository pages, IModuleDefinitionRepository moduleDefinitions, ISettingRepository settings, IUserPermissions userPermissions, ITenantResolver tenants, ISyncManager syncManager, ILogManager logger)
 {
     _modules           = modules;
     _pageModules       = pageModules;
     _pages             = pages;
     _moduleDefinitions = moduleDefinitions;
     _settings          = settings;
     _userPermissions   = userPermissions;
     _tenants           = tenants;
     _syncManager       = syncManager;
     _logger            = logger;
 }
Beispiel #34
0
 public UsuarioController(UsuarioApp app, UserManager <ApplicationUser> userManager, ITenantResolver tenantResolver)
 {
     _app         = app;
     _userManager = userManager;
     _tenantId    = tenantResolver.GetTenantId();
 }
 /// <summary>
 /// Initialize the Middleware with a Tenant's resolver
 /// </summary>
 /// <param name="next">The next Middleware</param>
 /// <param name="resolver">The Tenant's resolver</param>
 /// <param name="callback">The Callback action</param>
 public TenantCoreMiddleware(OwinMiddleware next, ITenantResolver resolver, Func<ITenant, bool> callback = null)
     : base(next)
 {
     Resolver = resolver;
     Callback = callback;
 }