Fixes: U4-4010 Member and user session gets mixed - fixes how we detect a back office request + unit tests and added new IsBackOffice attribute

This commit is contained in:
Shannon
2014-01-15 13:17:38 +11:00
parent 75a42fd0d6
commit 3ef9635406
10 changed files with 148 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Mvc
{
@@ -86,14 +87,17 @@ namespace Umbraco.Web.Mvc
return MetadataStorage.GetOrAdd(type, type1 =>
{
var attribute = type.GetCustomAttribute<PluginControllerAttribute>(false);
var pluginAttribute = type.GetCustomAttribute<PluginControllerAttribute>(false);
//check if any inherited class of this type contains the IsBackOffice attribute
var backOfficeAttribute = type.GetCustomAttribute<IsBackOfficeAttribute>(true);
var meta = new PluginControllerMetadata()
{
AreaName = attribute == null ? null : attribute.AreaName,
AreaName = pluginAttribute == null ? null : pluginAttribute.AreaName,
ControllerName = ControllerExtensions.GetControllerName(type),
ControllerNamespace = type.Namespace,
ControllerType = type
ControllerType = type,
IsBackOffice = backOfficeAttribute != null
};
MetadataStorage.TryAdd(type, meta);