public async Task <System.Web.Mvc.ActionResult> Portal( string portalUri, string pageUri, string preview, [ModelBinder(typeof(ActionLinkModelBinder))] ActionLink actionLink, [ModelBinder(typeof(AuthTicketModelBinder))] AuthTicket authTicket, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(portalUri, PortalField.Project | PortalField.Owners, cancellationToken); if (portal == null) { return(HttpNotFound()); } if (!string.IsNullOrEmpty(portal.Domain)) { return(Redirect(string.Join("/", "http://www." + portal.Domain, pageUri))); } var security = await _securityManager.CheckAccessAsync(portal, User.Identity.Name, AccessPermission.CanView, cancellationToken); if (!security.AccessGranted) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } var pageLayers = await _portalManager.GetPageLayersByUriAsync(portal, pageUri, cancellationToken); if (pageLayers?.ContentPage == null) { return(HttpNotFound()); } return(View("Content", await CreateResultAsync(security, portal, pageLayers, actionLink, authTicket, preview == null, cancellationToken))); }
public async Task <IHttpActionResult> GetLayersByUriAsync(string portalUri, string pageUri, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(portalUri, PortalField.All, cancellationToken); await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanView, cancellationToken); var pageLayers = await _portalManager.GetPageLayersByUriAsync(portal, pageUri, cancellationToken); if (pageLayers?.ContentPage == null) { return(NotFound()); } var compilerResult = await _portalCompiler.CompileAsync( new PortalCompilerOptions ( portal : portal, contentPage : pageLayers.ContentPage, masterPages : pageLayers.MasterPages.ToImmutableArray() ), cancellationToken); return(Ok(ModelMapper.ToPageLayersDto(portal, compilerResult))); }