Merge remote-tracking branch 'origin/6.2.0' into 7.0.2
This commit is contained in:
@@ -30,8 +30,6 @@ namespace Umbraco.Core
|
||||
/// These are def back office:
|
||||
/// /Umbraco/RestServices = back office
|
||||
/// /Umbraco/BackOffice = back office
|
||||
/// /Umbraco/UmbracpApi = back office
|
||||
/// /Umbraco/UmbracoTrees = back office
|
||||
/// If it's not any of the above, and there's no extension then we cannot determine if it's back office or front-end
|
||||
/// so we can only assume that it is not back office. This will occur if people use an UmbracoApiController for the backoffice
|
||||
/// but do not inherit from UmbracoAuthorizedApiController and do not use [IsBackOffice] attribute.
|
||||
@@ -78,9 +76,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
//check for special back office paths
|
||||
if (urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/UmbracoApi/")
|
||||
|| urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/UmbracoTrees/")
|
||||
|| urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/BackOffice/")
|
||||
if (urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/BackOffice/")
|
||||
|| urlPath.InvariantStartsWith("/" + GlobalSettings.UmbracoMvcArea + "/RestServices/"))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace Umbraco.Tests
|
||||
[TestCase("http://www.domain.com/test/umbraco.aspx", "", false)]
|
||||
[TestCase("http://www.domain.com/Umbraco/restServices/blah", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/Backoffice/blah", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/umbracoapi/blah", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/umbracotrees/blah", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/anything", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/anything/", "", true)]
|
||||
[TestCase("http://www.domain.com/Umbraco/surface/blah", "", false)]
|
||||
|
||||
@@ -27,13 +27,20 @@ namespace Umbraco.Web.Mvc
|
||||
/// <param name="umbracoTokenValue">The DataToken value to set for the 'umbraco' key, this defaults to 'backoffice' </param>
|
||||
/// <param name="routeTokens">By default this value is just {action}/{id} but can be modified for things like web api routes</param>
|
||||
/// <param name="isMvc">Default is true for MVC, otherwise false for WebAPI</param>
|
||||
/// <param name="areaPathPrefix">
|
||||
/// If specified will add this string to the path between the umbraco path and the area path name, for example:
|
||||
/// /umbraco/CUSTOMPATHPREFIX/areaname
|
||||
/// if not specified, will just route like:
|
||||
/// /umbraco/areaname
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
internal static Route RouteControllerPlugin(this AreaRegistration area, string controllerName, Type controllerType, RouteCollection routes,
|
||||
string controllerSuffixName, string defaultAction, object defaultId,
|
||||
string umbracoTokenValue = "backoffice",
|
||||
string routeTokens = "{action}/{id}",
|
||||
bool isMvc = true)
|
||||
bool isMvc = true,
|
||||
string areaPathPrefix = "")
|
||||
{
|
||||
Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName");
|
||||
Mandate.ParameterNotNull(controllerSuffixName, "controllerSuffixName");
|
||||
@@ -44,8 +51,10 @@ namespace Umbraco.Web.Mvc
|
||||
|
||||
var umbracoArea = GlobalSettings.UmbracoMvcArea;
|
||||
|
||||
//routes are explicitly name with controller names and IDs
|
||||
var url = umbracoArea + "/" + area.AreaName + "/" + controllerName + "/" + routeTokens;
|
||||
//routes are explicitly named with controller names and IDs
|
||||
var url = umbracoArea + "/" +
|
||||
(areaPathPrefix.IsNullOrWhiteSpace() ? "" : areaPathPrefix + "/") +
|
||||
area.AreaName + "/" + controllerName + "/" + routeTokens;
|
||||
|
||||
Route controllerPluginRoute;
|
||||
//var meta = PluginController.GetMetadata(controllerType);
|
||||
|
||||
@@ -85,7 +85,9 @@ namespace Umbraco.Web.Mvc
|
||||
{
|
||||
foreach (var s in apiControllers)
|
||||
{
|
||||
this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api", isMvc: false);
|
||||
this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api",
|
||||
isMvc: false,
|
||||
areaPathPrefix: s.IsBackOffice ? "backoffice" : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user