public override async Task <IDisplayResult> UpdateAsync(ISite model, UpdateEditorContext context) { var user = _httpContextAccessor.HttpContext?.User; if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageNotificationSettings)) { return(null); } if (context.GroupId == GroupId) { var viewmodel = new SignalHubSettingsViewModel(); await context.Updater.TryUpdateModelAsync(viewmodel, Prefix); var settings = new SignalHubSettings { Connection = viewmodel.Connection, UseLocal = viewmodel.UseLocal, RedisBackplane = viewmodel.RedisBackplane, UseMessagePack = viewmodel.UseMessagePack }; await _tenantConfigStore.SaveAsync(GroupId, settings); // Reload the tenant to apply the settings await _orchardHost.ReloadShellContextAsync(_currentShellSettings); } return(await EditAsync(model, context)); }
public async Task ExecuteAsync(RecipeExecutionContext context) { if (!String.Equals(context.Name, nameof(AzureHubSettings), StringComparison.OrdinalIgnoreCase)) { return; } var model = context.Step; var settings = model.ToObject <AzureHubSettingsStepModel>().Settings; await _tenantConfigStore.SaveAsync(Constants.Features.AzureHub, settings); }
public override async Task <IDisplayResult> UpdateAsync(ISite model, UpdateEditorContext context) { var user = _httpContextAccessor.HttpContext?.User; if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageNotificationSettings)) { return(null); } if (context.GroupId == GroupId) { var viewmodel = new AzureHubSettingsViewModel(); await context.Updater.TryUpdateModelAsync(viewmodel, Prefix); if (!string.IsNullOrWhiteSpace(viewmodel.NotificationTags)) { model.Properties.TryAdd(nameof(AzureHubSettingsViewModel.NotificationTags), JArray.FromObject(viewmodel.NotificationTags.Split(',').Select(t => t.Trim()))); } else { model.Properties.Remove(nameof(AzureHubSettingsViewModel.NotificationTags)); } var settings = new AzureHubSettings { Hub = viewmodel.Hub, Connection = viewmodel.Connection }; await _tenantConfigStore.SaveAsync(GroupId, settings); // Reload the tenant to apply the settings await _orchardHost.ReloadShellContextAsync(_currentShellSettings); } return(await EditAsync(model, context)); }