/// <summary>
 /// Releases all shells so that new ones will be built for subsequent requests.
 /// Note: Can be used to free up resources after a given period of inactivity.
 /// </summary>
 public async static Task ReleaseAllShellContextsAsync(this IShellHost shellHost)
 {
     foreach (var shell in shellHost.ListShellContexts())
     {
         await shellHost.ReleaseShellContextAsync(shell.Settings);
     }
 }
 public ReverseProxySettingsDisplayDriver(
     IShellHost shellHost,
     ShellSettings shellSettings)
 {
     _shellHost     = shellHost;
     _shellSettings = shellSettings;
 }
Example #3
0
 public ShowServerInfoService(IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
                              IDateTimeProvider dateTimeProvider, IShellHost shellHost)
 {
     _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
     _dateTimeProvider = dateTimeProvider;
     _shellHost        = shellHost;
 }
Example #4
0
        public async Task RunRecipeAsync(IShellHost shellHost, string recipeName, string recipePath)
        {
            var shellScope = await shellHost.GetScopeAsync(TenantName);

            await shellScope.UsingAsync(async scope =>
            {
                var shellFeaturesManager = scope.ServiceProvider.GetRequiredService <IShellFeaturesManager>();
                var recipeHarvesters     = scope.ServiceProvider.GetRequiredService <IEnumerable <IRecipeHarvester> >();
                var recipeExecutor       = scope.ServiceProvider.GetRequiredService <IRecipeExecutor>();

                var recipeCollections = await Task.WhenAll(
                    recipeHarvesters.Select(recipe => recipe.HarvestRecipesAsync()));

                var recipes = recipeCollections.SelectMany(recipeCollection => recipeCollection);
                var recipe  = recipes
                              .FirstOrDefault(recipe => recipe.RecipeFileInfo.Name == recipeName && recipe.BasePath == recipePath);

                var executionId = Guid.NewGuid().ToString("n");

                await recipeExecutor.ExecuteAsync(
                    executionId,
                    recipe,
                    new Dictionary <string, object>(),
                    CancellationToken.None);
            });
        }
        public AdminController(
            IShellHost shellHost,
            IShellSettingsManager shellSettingsManager,
            IEnumerable <DatabaseProvider> databaseProviders,
            IAuthorizationService authorizationService,
            ShellSettings currentShellSettings,
            IFeatureProfilesService featureProfilesService,
            IEnumerable <IRecipeHarvester> recipeHarvesters,
            IDataProtectionProvider dataProtectorProvider,
            IClock clock,
            INotifier notifier,
            ISiteService siteService,
            ITenantValidator tenantValidator,
            IShapeFactory shapeFactory,
            IStringLocalizer <AdminController> stringLocalizer,
            IHtmlLocalizer <AdminController> htmlLocalizer)
        {
            _shellHost              = shellHost;
            _shellSettingsManager   = shellSettingsManager;
            _databaseProviders      = databaseProviders;
            _authorizationService   = authorizationService;
            _currentShellSettings   = currentShellSettings;
            _featureProfilesService = featureProfilesService;
            _recipeHarvesters       = recipeHarvesters;
            _dataProtectorProvider  = dataProtectorProvider;
            _clock           = clock;
            _notifier        = notifier;
            _siteService     = siteService;
            _tenantValidator = tenantValidator;

            New = shapeFactory;
            S   = stringLocalizer;
            H   = htmlLocalizer;
        }
Example #6
0
 public ProfileService(ISession session, IShellHost shellHost, ShellSettings shellSettings, UserManager <IUser> userManager)
 {
     _session       = session;
     _shellSettings = shellSettings;
     _shellHost     = shellHost;
     _userManager   = userManager;
 }
Example #7
0
 public OrchardShellHostMiddleware(
     RequestDelegate next,
     IShellHost shellHost)
 {
     _next      = next;
     _shellHost = shellHost;
 }
Example #8
0
 public CreateAndSetUpTenantTask(IShellSettingsManager shellSettingsManager, IShellHost shellHost, ISetupService setupService, IClock clock, IWorkflowExpressionEvaluator expressionEvaluator, IWorkflowScriptEvaluator scriptEvaluator, IUpdateModelAccessor updateModelAccessor, IStringLocalizer <CreateAndSetUpTenantTask> localizer)
     : base(shellSettingsManager, shellHost, expressionEvaluator, scriptEvaluator, localizer)
 {
     SetupService         = setupService;
     _clock               = clock;
     _updateModelAccessor = updateModelAccessor;
 }
        public OrchardShellHostMiddleware(
            RequestDelegate next,
            IShellHost shellHost) {

            _next = next;
            _shellHost = shellHost;
        }
        public ApiController(
            IShellHost shellHost,
            ShellSettings currentShellSettings,
            IAuthorizationService authorizationService,
            IShellSettingsManager shellSettingsManager,
            IEnumerable <DatabaseProvider> databaseProviders,
            IDataProtectionProvider dataProtectorProvider,
            ISetupService setupService,
            IClock clock,
            INotifier notifier,
            IEnumerable <IRecipeHarvester> recipeHarvesters,
            IStringLocalizer <AdminController> stringLocalizer,
            IHtmlLocalizer <AdminController> htmlLocalizer)
        {
            _dataProtectorProvider = dataProtectorProvider;
            _setupService          = setupService;
            _clock                = clock;
            _recipeHarvesters     = recipeHarvesters;
            _shellHost            = shellHost;
            _authorizationService = authorizationService;
            _shellSettingsManager = shellSettingsManager;
            _databaseProviders    = databaseProviders;
            _currentShellSettings = currentShellSettings;
            _notifier             = notifier;

            S = stringLocalizer;
            H = htmlLocalizer;
        }
Example #11
0
 /// <summary>
 /// Releases all shells so that new ones will be built for subsequent requests.
 /// Note: Can be used to free up resources after a given period of inactivity.
 /// </summary>
 public async static Task ReleaseAllShellContextsAsync(this IShellHost shellHost)
 {
     foreach (var settings in shellHost.GetAllSettings())
     {
         await shellHost.ReleaseShellContextAsync(settings);
     }
 }
Example #12
0
 protected TenantActivity(IShellSettingsManager shellSettingsManager, IShellHost shellHost, IWorkflowScriptEvaluator scriptEvaluator, IStringLocalizer localizer)
 {
     ShellSettingsManager = shellSettingsManager;
     ShellHost            = shellHost;
     ScriptEvaluator      = scriptEvaluator;
     S = localizer;
 }
Example #13
0
 public ApiController(
     IShellHost shellHost,
     ShellSettings currentShellSettings,
     IAuthorizationService authorizationService,
     IShellSettingsManager shellSettingsManager,
     IDataProtectionProvider dataProtectorProvider,
     ISetupService setupService,
     IClock clock,
     IEmailAddressValidator emailAddressValidator,
     IFeatureProfilesService featureProfilesService,
     IOptions <IdentityOptions> identityOptions,
     IEnumerable <DatabaseProvider> databaseProviders,
     IStringLocalizer <AdminController> stringLocalizer)
 {
     _shellHost             = shellHost;
     _currentShellSettings  = currentShellSettings;
     _authorizationService  = authorizationService;
     _dataProtectorProvider = dataProtectorProvider;
     _shellSettingsManager  = shellSettingsManager;
     _setupService          = setupService;
     _clock = clock;
     _emailAddressValidator  = emailAddressValidator;
     _featureProfilesService = featureProfilesService;
     _identityOptions        = identityOptions.Value;
     _databaseProviders      = databaseProviders;
     S = stringLocalizer;
 }
Example #14
0
 public ModularTenantContainerMiddleware(RequestDelegate next, IShellHost shellHost, IRunningShellTable runningShellTable)
 {
     base();
     this._next              = next;
     this._shellHost         = shellHost;
     this._runningShellTable = runningShellTable;
     return;
 }
 public DefaultSiteSettingsDisplayDriver(
     IShellHost shellHost,
     ShellSettings shellSettings
     )
 {
     _shellHost     = shellHost;
     _shellSettings = shellSettings;
 }
 public MiniProgramSettingDisplayDriver(IAuthorizationService authorizationService,
                                        IHttpContextAccessor hca, IShellHost shellHost, ShellSettings shellSettings)
 {
     _authorizationService = authorizationService;
     _hca           = hca;
     _shellHost     = shellHost;
     _shellSettings = shellSettings;
 }
Example #17
0
        /// <summary>
        /// Tries to creates a standalone service scope that can be used to resolve local services and
        /// replaces <see cref="HttpContext.RequestServices"/> with it.
        /// </summary>
        /// <param name="tenant">The tenant name related to the service scope to get.</param>
        /// <returns>An associated scope if the tenant name is valid, otherwise null.</returns>
        /// <remarks>
        /// Disposing the returned <see cref="IServiceScope"/> instance restores the previous state.
        /// </remarks>
        public static async Task <IServiceScope> TryGetScopeAsync(this IShellHost shellHost, string tenant)
        {
            if (!shellHost.TryGetSettings(tenant, out var settings))
            {
                return(null);
            }

            return((await shellHost.GetScopeAndContextAsync(settings)).Scope);
        }
Example #18
0
        /// <summary>
        /// Retrieves the shell settings associated with the specified tenant.
        /// </summary>
        /// <returns>The shell settings associated with the tenant.</returns>
        public static ShellSettings GetSettings(this IShellHost shellHost, string name)
        {
            if (!shellHost.TryGetSettings(name, out ShellSettings settings))
            {
                throw new ArgumentException("The specified tenant name is not valid.", nameof(name));
            }

            return(settings);
        }
Example #19
0
 public ReverseProxySettingsDisplayDriver(
     IShellHost shellHost,
     ShellSettings shellSettings,
     IHtmlLocalizer <ReverseProxySettingsDisplayDriver> stringLocalizer)
 {
     _shellHost     = shellHost;
     _shellSettings = shellSettings;
     T = stringLocalizer;
 }
Example #20
0
 public ModularTenantContainerMiddleware(
     RequestDelegate next,
     IShellHost shellHost,
     IRunningShellTable runningShellTable)
 {
     _next              = next;
     _shellHost         = shellHost;
     _runningShellTable = runningShellTable;
 }
Example #21
0
 public CreateTenantTask(
     IShellSettingsManager shellSettingsManager,
     IShellHost shellHost,
     IWorkflowExpressionEvaluator expressionEvaluator,
     IWorkflowScriptEvaluator scriptEvaluator,
     IStringLocalizer <CreateTenantTask> localizer)
     : base(shellSettingsManager, shellHost, expressionEvaluator, scriptEvaluator, localizer)
 {
 }
Example #22
0
 public ModularBackgroundService(
     IShellHost shellHost,
     IHttpContextAccessor httpContextAccessor,
     ILogger <ModularBackgroundService> logger)
 {
     _shellHost           = shellHost;
     _httpContextAccessor = httpContextAccessor;
     Logger = logger;
 }
Example #23
0
        public CommandHostAgent(IShellHost orchardHost,
                                IShellSettingsManager shellSettingsManager,
                                IStringLocalizer localizer)
        {
            _orchardHost          = orchardHost;
            _shellSettingsManager = shellSettingsManager;

            T = localizer;
        }
Example #24
0
 public DefaultSiteSettingsDisplayDriver(
     IShellHost shellHost,
     ShellSettings shellSettings,
     IStringLocalizer <DefaultSiteSettingsDisplayDriver> stringLocalizer
     )
 {
     _shellHost     = shellHost;
     _shellSettings = shellSettings;
     S = stringLocalizer;
 }
 public LeverPostingService(ILogger <LeverPostingService> logger, IPostingApiService postingApiService, ISession session, IShellHost shellHost, ShellSettings shellSettings, ISiteService siteService, ISlugService slugService)
 {
     _logger            = logger;
     _postingApiService = postingApiService;
     _session           = session;
     _shellSettings     = shellSettings;
     _shellHost         = shellHost;
     _siteService       = siteService;
     _slugService       = slugService;
 }
Example #26
0
 public RecipeExecutor(IEnumerable <IRecipeEventHandler> recipeEventHandlers,
                       ShellSettings shellSettings,
                       IShellHost shellHost,
                       ILogger <RecipeExecutor> logger)
 {
     _shellHost           = shellHost;
     _shellSettings       = shellSettings;
     _recipeEventHandlers = recipeEventHandlers;
     _logger = logger;
 }
Example #27
0
 public ModularBackgroundService(IShellHost shellHost, IHttpContextAccessor httpContextAccessor, ILogger <ModularBackgroundService> logger)
 {
     this._schedulers   = new ConcurrentDictionary <string, BackgroundTaskScheduler>();
     this._changeTokens = new ConcurrentDictionary <string, IChangeToken>();
     base();
     this._shellHost           = shellHost;
     this._httpContextAccessor = httpContextAccessor;
     this._logger = logger;
     return;
 }
 public FacebookLoginSettingsDisplayDriver(
     IAuthorizationService authorizationService,
     IHttpContextAccessor httpContextAccessor,
     IShellHost shellHost,
     ShellSettings shellSettings)
 {
     _authorizationService = authorizationService;
     _httpContextAccessor  = httpContextAccessor;
     _shellHost            = shellHost;
     _shellSettings        = shellSettings;
 }
 public HttpsSettingsUpdater(
     ISiteService siteService,
     IShellConfiguration shellConfiguration,
     IShellHost shellHost,
     ShellSettings shellSettings)
 {
     _siteService        = siteService;
     _shellConfiguration = shellConfiguration;
     _shellHost          = shellHost;
     _shellSettings      = shellSettings;
 }
 public ReverseProxySettingsDisplayDriver(
     IShellHost shellHost,
     ShellSettings shellSettings,
     IHttpContextAccessor httpContextAccessor,
     IAuthorizationService authorizationService)
 {
     _shellHost            = shellHost;
     _shellSettings        = shellSettings;
     _httpContextAccessor  = httpContextAccessor;
     _authorizationService = authorizationService;
 }
Example #31
0
 public ModularTenantContainerMiddleware(
     RequestDelegate next,
     IShellHost orchardHost,
     IRunningShellTable runningShellTable,
     ILogger <ModularTenantContainerMiddleware> logger)
 {
     _next              = next;
     _orchardHost       = orchardHost;
     _runningShellTable = runningShellTable;
     _logger            = logger;
 }