Esempio n. 1
0
        private SiteMapNode CreateNodeFromPage(PortalPage page)
        {
            string url = String.IsNullOrEmpty(page.Url) ? DEFAULT_PAGE_URL + page.Name : page.Url;

            string localizedName = DefaultPage.GetLocalizedPageName(page.Name);

            NameValueCollection attrs = new NameValueCollection();

            attrs["target"] = page.Target;
            attrs["align"]  = page.Align;

            SiteMapNode node = new SiteMapNode(this, page.Name,
                                               url,
                                               localizedName,
                                               localizedName, page.Roles, attrs, null, null);

            if (!page.Enabled)
            {
                node.Url = "";
            }

            if (IsNodeAccessibleToUser(HttpContext.Current, node))
            {
                return(node);
            }
            return(null);
        }
Esempio n. 2
0
 private bool IsNodeAccessibleToUser(HttpContext context, SiteMapNode node)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (!this.SecurityTrimmingEnabled)
     {
         return(true);
     }
     if (node.Roles != null)
     {
         return(DefaultPage.IsAccessibleToUser(HttpContext.Current, node.Roles));
     }
     return(false);
 }