Exemple #1
0
        public virtual ISiteMapNodeCollection GetChildNodes(ISiteMapNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            ISiteMapNodeCollection collection = null;

            if (this.childNodeCollectionTable.ContainsKey(node))
            {
                collection = this.childNodeCollectionTable[node];
            }
            if (collection == null)
            {
                ISiteMapNode keyNode = null;
                if (this.keyTable.ContainsKey(node.Key))
                {
                    keyNode = this.keyTable[node.Key];
                }
                if (keyNode != null && this.childNodeCollectionTable.ContainsKey(keyNode))
                {
                    collection = this.childNodeCollectionTable[keyNode];
                }
            }
            if (collection == null)
            {
                return(siteMapChildStateFactory.CreateEmptyReadOnlySiteMapNodeCollection());
            }
            if (!this.SecurityTrimmingEnabled)
            {
                return(siteMapChildStateFactory.CreateReadOnlySiteMapNodeCollection(collection));
            }
            var secureCollection = siteMapChildStateFactory.CreateSiteMapNodeCollection();

            foreach (ISiteMapNode secureNode in collection)
            {
                if (secureNode.IsAccessibleToUser())
                {
                    secureCollection.Add(secureNode);
                }
            }
            return(siteMapChildStateFactory.CreateReadOnlySiteMapNodeCollection(secureCollection));
        }