public ActionResult Index(string pageId, string pageContentId)
{
var principal = SecurityService.GetCurrentPrincipal();
var allRoles = new List<string>(RootModuleConstants.UserRoles.AllRoles);
if (!string.IsNullOrEmpty(cmsConfiguration.Security.FullAccessRoles))
{
allRoles.Add(cmsConfiguration.Security.FullAccessRoles);
}
var request = new GetPageToRenderRequest
{
PageId = pageId.ToGuidOrDefault(),
PreviewPageContentId = pageContentId.ToGuidOrDefault(),
IsPreview = true,
HasContentAccess = SecurityService.IsAuthorized(principal, RootModuleConstants.UserRoles.MultipleRoles(allRoles.ToArray()))
};
var model = GetCommand<GetPageToRenderCommand>().ExecuteCommand(request);
if (model != null && model.RenderPage != null)
{
// Render page with hierarchical master pages
var html = this.RenderPageToString(model.RenderPage);
html = PageHtmlRenderer.ReplaceRegionRepresentationHtml(html, string.Empty);
return Content(html);
}
return HttpNotFound();
}
}