Migrates preview auth Middleware
Migrates UriExtensionsTests to netcore, fixes preview controller bits, adds tests for preview path for back office route check, fixes virtual paths for views,
This commit is contained in:
@@ -4,23 +4,20 @@ using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Features;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
// TODO: Almost nothing here needs to exist since we can inject these into the view
|
||||
public class BackOfficePreviewModel : BackOfficeModel
|
||||
public class BackOfficePreviewModel
|
||||
{
|
||||
private readonly UmbracoFeatures _features;
|
||||
public IEnumerable<ILanguage> Languages { get; }
|
||||
|
||||
public BackOfficePreviewModel(UmbracoFeatures features, IGlobalSettings globalSettings, IUmbracoVersion umbracoVersion, IEnumerable<ILanguage> languages, IContentSettings contentSettings, IHostingEnvironment hostingEnvironment, IRuntimeSettings runtimeSettings, ISecuritySettings securitySettings)
|
||||
: base(features, globalSettings, umbracoVersion, contentSettings, hostingEnvironment, runtimeSettings, securitySettings)
|
||||
|
||||
public BackOfficePreviewModel(UmbracoFeatures features, IEnumerable<ILanguage> languages)
|
||||
{
|
||||
_features = features;
|
||||
Languages = languages;
|
||||
}
|
||||
|
||||
public IEnumerable<ILanguage> Languages { get; }
|
||||
public bool DisableDevicePreview => _features.Disabled.DisableDevicePreview;
|
||||
public string PreviewExtendedHeaderView => _features.Enabled.PreviewExtendedView;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
//check for special back office paths
|
||||
if (urlPath.InvariantStartsWith("/" + mvcArea + "/" + Constants.Web.Mvc.BackOfficePathSegment + "/"))
|
||||
if (urlPath.InvariantStartsWith("/" + mvcArea + "/BackOffice/")
|
||||
|| urlPath.InvariantStartsWith("/" + mvcArea + "/Preview/"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,6 @@ namespace Umbraco.Web
|
||||
return cookieManager.GetCookieValue(Constants.Web.PreviewCookieName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does a preview cookie exist ?
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasPreviewCookie(this ICookieManager cookieManager)
|
||||
{
|
||||
return cookieManager.HasCookie(Constants.Web.PreviewCookieName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user