Beispiel #1
0
        public SiteMapNodeCollection GetAllNodes()
        {
            SiteMapNodeCollection collection = new SiteMapNodeCollection();

            GetAllNodesRecursive(collection);
            return(SiteMapNodeCollection.ReadOnly(collection));
        }
Beispiel #2
0
        public SiteMapNodeCollection GetAllNodes()
        {
            SiteMapNodeCollection ret;

            ret = new SiteMapNodeCollection();
            GetAllNodesRecursive(ret);
            return(SiteMapNodeCollection.ReadOnly(ret));
        }
Beispiel #3
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            BuildSiteMap();
            SiteMapNodeCollection col;

            if (!nodeToChildren.TryGetValue(node, out col))
            {
                return(SiteMapNodeCollection.EmptyCollection);
            }

            SiteMapNodeCollection ret = null;

            for (int n = 0; n < col.Count; n++)
            {
                if (!IsAccessibleToUser(HttpContext.Current, col[n]))
                {
                    if (ret == null)
                    {
                        ret = new SiteMapNodeCollection();
                        for (int m = 0; m < n; m++)
                        {
                            ret.Add(col[m]);
                        }
                    }
                }
                else if (ret != null)
                {
                    ret.Add(col[n]);
                }
            }

            if (ret == null)
            {
                return(SiteMapNodeCollection.ReadOnly(col));
            }
            else if (ret.Count > 0)
            {
                return(SiteMapNodeCollection.ReadOnly(ret));
            }
            else
            {
                return(SiteMapNodeCollection.EmptyCollection);
            }
        }
        // Return readonly child node collection

        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            BuildSiteMap();
            SiteMapNodeCollection collection = (SiteMapNodeCollection)ChildNodeCollectionTable[node];

            if (collection == null)
            {
                SiteMapNode childNodeFromKey = (SiteMapNode)KeyTable[node.Key];
                if (childNodeFromKey != null)
                {
                    collection = (SiteMapNodeCollection)ChildNodeCollectionTable[childNodeFromKey];
                }
            }

            if (collection != null)
            {
                if (!SecurityTrimmingEnabled)
                {
                    return(SiteMapNodeCollection.ReadOnly(collection));
                }

                HttpContext           context           = HttpContext.Current;
                SiteMapNodeCollection trimmedCollection = new SiteMapNodeCollection(collection.Count);
                foreach (SiteMapNode subNode in collection)
                {
                    if (subNode.IsAccessibleToUser(context))
                    {
                        trimmedCollection.Add(subNode);
                    }
                }

                return(SiteMapNodeCollection.ReadOnly(trimmedCollection));
            }

            return(SiteMapNodeCollection.Empty);
        }
Beispiel #5
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            this.BuildSiteMap();
            SiteMapNodeCollection collection = (SiteMapNodeCollection)this.ChildNodeCollectionTable[node];

            if (collection == null)
            {
                SiteMapNode node2 = (SiteMapNode)this.KeyTable[node.Key];
                if (node2 != null)
                {
                    collection = (SiteMapNodeCollection)this.ChildNodeCollectionTable[node2];
                }
            }
            if (collection == null)
            {
                return(SiteMapNodeCollection.Empty);
            }
            if (!base.SecurityTrimmingEnabled)
            {
                return(SiteMapNodeCollection.ReadOnly(collection));
            }
            HttpContext           current = HttpContext.Current;
            SiteMapNodeCollection nodes2  = new SiteMapNodeCollection(collection.Count);

            foreach (SiteMapNode node3 in collection)
            {
                if (node3.IsAccessibleToUser(current))
                {
                    nodes2.Add(node3);
                }
            }
            return(SiteMapNodeCollection.ReadOnly(nodes2));
        }