From c2bb9372e73d9a50d91cb717b30378c63c51c6f4 Mon Sep 17 00:00:00 2001 From: attilah Date: Wed, 9 Mar 2011 17:31:53 +0100 Subject: [PATCH] Fixed: #16884 - SessionConfigurationCache throws SecurityExceptions at startup in Medium Trust --HG-- branch : contributions --- src/Orchard/Data/SessionConfigurationCache.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Orchard/Data/SessionConfigurationCache.cs b/src/Orchard/Data/SessionConfigurationCache.cs index 2bc3a3a7c..00c529904 100644 --- a/src/Orchard/Data/SessionConfigurationCache.cs +++ b/src/Orchard/Data/SessionConfigurationCache.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Reflection; using System.Runtime.Serialization.Formatters.Binary; using NHibernate.Cfg; +using Orchard.Environment; using Orchard.Environment.Configuration; using Orchard.Environment.ShellBuilders.Models; using Orchard.FileSystems.AppData; @@ -14,11 +15,13 @@ namespace Orchard.Data { private readonly ShellSettings _shellSettings; private readonly ShellBlueprint _shellBlueprint; private readonly IAppDataFolder _appDataFolder; + private readonly IHostEnvironment _hostEnvironment; - public SessionConfigurationCache(ShellSettings shellSettings, ShellBlueprint shellBlueprint, IAppDataFolder appDataFolder) { + public SessionConfigurationCache(ShellSettings shellSettings, ShellBlueprint shellBlueprint, IAppDataFolder appDataFolder, IHostEnvironment hostEnvironment) { _shellSettings = shellSettings; _shellBlueprint = shellBlueprint; _appDataFolder = appDataFolder; + _hostEnvironment = hostEnvironment; Logger = NullLogger.Instance; } @@ -51,6 +54,9 @@ namespace Orchard.Data { } private void StoreConfiguration(ConfigurationCache cache) { + if (!_hostEnvironment.IsFullTrust) + return; + var pathName = GetPathName(_shellSettings.Name); try { @@ -70,6 +76,9 @@ namespace Orchard.Data { } private ConfigurationCache ReadConfiguration(string hash) { + if (!_hostEnvironment.IsFullTrust) + return null; + var pathName = GetPathName(_shellSettings.Name); if (!_appDataFolder.FileExists(pathName))