mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Medium Trust: Testing for full trust instead of demanding permission to avoid secannotate warning.
--HG-- branch : dev
This commit is contained in:
@@ -16,11 +16,10 @@ namespace Orchard.Logging {
|
|||||||
// by default, use Orchard's logger that delegates to Castle's logger factory
|
// by default, use Orchard's logger that delegates to Castle's logger factory
|
||||||
moduleBuilder.RegisterType<CastleLoggerFactory>().As<ILoggerFactory>().InstancePerLifetimeScope();
|
moduleBuilder.RegisterType<CastleLoggerFactory>().As<ILoggerFactory>().InstancePerLifetimeScope();
|
||||||
|
|
||||||
try {
|
// Register logger type
|
||||||
// by default, use Castle's TraceSource based logger factory
|
if (AppDomain.CurrentDomain.IsHomogenous && AppDomain.CurrentDomain.IsFullyTrusted) {
|
||||||
new SecurityPermission(SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy).Demand();
|
|
||||||
moduleBuilder.RegisterType<TraceLoggerFactory>().As<Castle.Core.Logging.ILoggerFactory>().InstancePerLifetimeScope();
|
moduleBuilder.RegisterType<TraceLoggerFactory>().As<Castle.Core.Logging.ILoggerFactory>().InstancePerLifetimeScope();
|
||||||
} catch (SecurityException) {
|
} else {
|
||||||
// if security model does not allow it, fall back to null logger factory
|
// if security model does not allow it, fall back to null logger factory
|
||||||
moduleBuilder.RegisterType<NullLogFactory>().As<Castle.Core.Logging.ILoggerFactory>().InstancePerLifetimeScope();
|
moduleBuilder.RegisterType<NullLogFactory>().As<Castle.Core.Logging.ILoggerFactory>().InstancePerLifetimeScope();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user