Skip to content

Commit

Permalink
Fixed incorrect logic in SiteMapPathHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
NightOwl888 committed Aug 18, 2013
1 parent 99f48b9 commit 15692d0
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,20 @@ private static SiteMapPathHelperModel BuildModel(MvcSiteMapHtmlHelper helper, So
// Build model
var model = new SiteMapPathHelperModel();
var node = startingNode;
// Check visibility and ACL
if (node != null && node.IsVisible(sourceMetadata) && node.IsAccessibleToUser())
while (node != null)
{
// Add node
model.Nodes.AddRange((new SiteMapNodeModel(node, sourceMetadata)).Ancestors);
bool nodeVisible = node.IsVisible(sourceMetadata);
if (nodeVisible && node.IsAccessibleToUser())
{
var nodeToAdd = new SiteMapNodeModel(node, sourceMetadata);
model.Nodes.Add(nodeToAdd);
}
node = node.ParentNode;
}
model.Nodes.Reverse();

return model;

}

/// <summary>
Expand Down

0 comments on commit 15692d0

Please sign in to comment.