diff --git a/src/VirtoCommerce.Platform.Core/PlatformUIOptions.cs b/src/VirtoCommerce.Platform.Core/PlatformUIOptions.cs new file mode 100644 index 0000000000..2bf30d0c4c --- /dev/null +++ b/src/VirtoCommerce.Platform.Core/PlatformUIOptions.cs @@ -0,0 +1,7 @@ +namespace VirtoCommerce.Platform.Core +{ + public class PlatformUIOptions + { + public bool Enable { get; set; } = true; + } +} diff --git a/src/VirtoCommerce.Platform.Web/Controllers/HomeController.cs b/src/VirtoCommerce.Platform.Web/Controllers/HomeController.cs index b3dbb20775..eb152a6925 100644 --- a/src/VirtoCommerce.Platform.Web/Controllers/HomeController.cs +++ b/src/VirtoCommerce.Platform.Web/Controllers/HomeController.cs @@ -24,20 +24,34 @@ public class HomeController : Controller private readonly WebAnalyticsOptions _webAnalyticsOptions; private readonly LocalStorageModuleCatalogOptions _localStorageModuleCatalogOptions; private readonly LicenseProvider _licenseProvider; + private readonly PlatformUIOptions _platformUIOptions; private readonly ISettingsManager _settingsManager; - public HomeController(IOptions platformOptions, IOptions webAnalyticsOptions, IOptions localStorageModuleCatalogOptions, IOptions pushNotificationOptions, LicenseProvider licenseProvider, ISettingsManager settingsManager) + public HomeController( + IOptions platformOptions, + IOptions webAnalyticsOptions, + IOptions localStorageModuleCatalogOptions, + IOptions pushNotificationOptions, + IOptions platformUIOptions, + LicenseProvider licenseProvider, + ISettingsManager settingsManager) { _platformOptions = platformOptions.Value; _webAnalyticsOptions = webAnalyticsOptions.Value; _localStorageModuleCatalogOptions = localStorageModuleCatalogOptions.Value; _pushNotificationOptions = pushNotificationOptions.Value; + _platformUIOptions = platformUIOptions.Value; _licenseProvider = licenseProvider; _settingsManager = settingsManager; } public async Task Index() { + if (!_platformUIOptions.Enable) + { + return Forbid(); + } + var model = new IndexModel { PlatformVersion = new HtmlString(Core.Common.PlatformVersion.CurrentVersion.ToString()), diff --git a/src/VirtoCommerce.Platform.Web/Startup.cs b/src/VirtoCommerce.Platform.Web/Startup.cs index 4369153e61..626d158809 100644 --- a/src/VirtoCommerce.Platform.Web/Startup.cs +++ b/src/VirtoCommerce.Platform.Web/Startup.cs @@ -526,6 +526,9 @@ public void ConfigureServices(IServiceCollection services) break; } + // Platform UI options + services.AddOptions().Bind(Configuration.GetSection("VirtoCommerce:PlatformUI")); + // Add login page UI options var loginPageUIOptions = Configuration.GetSection("LoginPageUI"); services.AddOptions().Bind(loginPageUIOptions); diff --git a/src/VirtoCommerce.Platform.Web/appsettings.json b/src/VirtoCommerce.Platform.Web/appsettings.json index 564fc2e82b..0e84f434fd 100644 --- a/src/VirtoCommerce.Platform.Web/appsettings.json +++ b/src/VirtoCommerce.Platform.Web/appsettings.json @@ -40,6 +40,9 @@ "GraphQLPlayground": { "Enable": true }, + "PlatformUI": { + "Enable": true + }, "Hangfire": { "JobStorageType": "Database", //Set value to false to stop processing the background jobs.