Hide pages in the page tree in EPiServer 7
On a large site with alot of editors, you can assist them by hiding parts of the page tree they don't have access to.
Sometimes it could be useful to manipulate how certain pages are displayed in the page tree in EPiServer 7. Because the page tree is loaded from a REST based store, all you really need to do is provide a custom implementation of the ContentQuery responsible for loading the children.
The REST stores in EPiServer are discovered at application startup. The ContentStructureStore which is used for loading content into the page tree, will be provided with a number of ContentQuery classes at initialization. One of them is EPiServer.Cms.Shell.UI.Rest.ContentQuery.GetChildrenQuery. I'll show you how to manipulate this.
Provide your custom query
First add a reference to EPiServer.Cms.Shell.UI assembly. Yes, you will now have a dependency to an EPiServer module, so think about that for a moment.
Then add your own GetChildrenQuery class. You get alot of good stuff through the ContentQueryParameters object passed to GetContent, such as CurrentPrincipal, CurrentLanguage etc.
So, short example. I’ll hide all pages of the type DivisionPage that the editor doesn’t have permission to edit.