mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixed: #16884 - SessionConfigurationCache throws SecurityExceptions at startup in Medium Trust
--HG-- branch : contributions
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using NHibernate.Cfg;
|
using NHibernate.Cfg;
|
||||||
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.ShellBuilders.Models;
|
using Orchard.Environment.ShellBuilders.Models;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
@@ -14,11 +15,13 @@ namespace Orchard.Data {
|
|||||||
private readonly ShellSettings _shellSettings;
|
private readonly ShellSettings _shellSettings;
|
||||||
private readonly ShellBlueprint _shellBlueprint;
|
private readonly ShellBlueprint _shellBlueprint;
|
||||||
private readonly IAppDataFolder _appDataFolder;
|
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;
|
_shellSettings = shellSettings;
|
||||||
_shellBlueprint = shellBlueprint;
|
_shellBlueprint = shellBlueprint;
|
||||||
_appDataFolder = appDataFolder;
|
_appDataFolder = appDataFolder;
|
||||||
|
_hostEnvironment = hostEnvironment;
|
||||||
|
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
@@ -51,6 +54,9 @@ namespace Orchard.Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void StoreConfiguration(ConfigurationCache cache) {
|
private void StoreConfiguration(ConfigurationCache cache) {
|
||||||
|
if (!_hostEnvironment.IsFullTrust)
|
||||||
|
return;
|
||||||
|
|
||||||
var pathName = GetPathName(_shellSettings.Name);
|
var pathName = GetPathName(_shellSettings.Name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -70,6 +76,9 @@ namespace Orchard.Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ConfigurationCache ReadConfiguration(string hash) {
|
private ConfigurationCache ReadConfiguration(string hash) {
|
||||||
|
if (!_hostEnvironment.IsFullTrust)
|
||||||
|
return null;
|
||||||
|
|
||||||
var pathName = GetPathName(_shellSettings.Name);
|
var pathName = GetPathName(_shellSettings.Name);
|
||||||
|
|
||||||
if (!_appDataFolder.FileExists(pathName))
|
if (!_appDataFolder.FileExists(pathName))
|
||||||
|
|||||||
Reference in New Issue
Block a user