diff --git a/Lombiq.Hosting.Tenants.Admin.Login/Filters/TenantsIndexFilter.cs b/Lombiq.Hosting.Tenants.Admin.Login/Filters/TenantsIndexFilter.cs index 58ba9d3d..0e75356e 100644 --- a/Lombiq.Hosting.Tenants.Admin.Login/Filters/TenantsIndexFilter.cs +++ b/Lombiq.Hosting.Tenants.Admin.Login/Filters/TenantsIndexFilter.cs @@ -45,7 +45,7 @@ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultE if (actionRouteController == typeof(AdminController).ControllerName() && actionRouteArea == $"{nameof(OrchardCore)}.{nameof(OrchardCore.Tenants)}" && actionRouteValue is nameof(AdminController.Edit) && - context.Result is ViewResult viewResult && + context.Result is ViewResult && await _authorizationService.AuthorizeAsync( _hca.HttpContext.User, TenantAdminPermissions.LoginAsAdmin) diff --git a/Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs b/Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs index fa980d7c..1a80febc 100644 --- a/Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs +++ b/Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs @@ -83,20 +83,14 @@ public async Task EnableConditionallyEnabledFeaturesAsync(IFeatureInfo featureIn .Select(keyValuePair => keyValuePair.Key) .ToList(); - // Handle multiple conditional features as well. - var conditionalFeatures = allFeatures.Where(feature => conditionalFeatureIds.Contains(feature.Id)); - // During setup, Shell Descriptor can become out of sync with the DB when it comes to enabled features, // but it's more accurate than IShellDescriptorManager's methods. var shellDescriptor = await _shellDescriptorManager.GetShellDescriptorAsync(); // If Shell Descriptor's Features already contains a feature that is found in conditionalFeatures, remove it - // from the list. - var featuresToEnable = conditionalFeatures.ToList(); - foreach (var feature in conditionalFeatures.Where(feature => shellDescriptor.Features.Contains(new ShellFeature(feature.Id)))) - { - featuresToEnable.Remove(feature); - } + // from the list. Handle multiple conditional features as well. + var featuresToEnable = allFeatures.Where(feature => + conditionalFeatureIds.Contains(feature.Id) && !shellDescriptor.Features.Contains(new ShellFeature(feature.Id))); await _shellFeaturesManager.EnableFeaturesAsync(featuresToEnable, force: true); }