Is it possible in some way to hide pages in the edit page tree based on permissions? If a user does not have permissions to edit a page I would like it to be hidden for that user.
/Mattias
At this moment there is no support for this feature. It is however a pretty common request and has been on the "feature request" list for sometime. So it is not unlikely that it will be implemented in the future.
Ok, so there is absolutely no way I can do this? I played with the user control pageexplorer.ascx and hoped there was an event I could tap into. I found PageTreeViewItemDataBound but realized I cannot modify the PageTreeNode collection at that point.
No other ideas, ugly or clean, of how this can be solved?
/Mattias
You can try the following code, works for me. :D
//Create an event-handle for FinishedLoadingChildren, when the item in the tress are loaded, but not rendered yet.
EPiServer.DataFactory.Instance.FinishedLoadingChildren += new ChildrenEventHandler(Instance_FinishedLoadingChildren);
if (HttpContext.Current.Request.Url.ToString().StartsWith(EPiServer.Configuration.Settings.Instance.UIUrl.ToString()))
{
if (e.PageLink == PageReference.RootPage) //applies from RootPage
{
int pageId = 123; //
for (int i = e.Children.Count - 1; i >= 0; i--)
{
//Try to hide the page id = 123 by removing it from the collection
if (e.Children[i].PageLink.ID == pageId)
{
e.Children.RemoveAt(i);
break;
}
}
}
}