예제 #1
0
        public async Task <System.Web.Mvc.ActionResult> Domain(
            string domain,
            string pageUri,
            string preview,
            [ModelBinder(typeof(ActionLinkModelBinder))] ActionLink actionLink,
            [ModelBinder(typeof(AuthTicketModelBinder))] AuthTicket authTicket,
            CancellationToken cancellationToken)
        {
            var portal = await _portalManager.FindByDomainAsync(domain, PortalField.Project | PortalField.Owners, cancellationToken);

            if (portal == null)
            {
                return(HttpNotFound());
            }
            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)));
        }