Set edit tree start page depending on user rights

Vote:
 

I would like to set the start page in the edit tree depending on the current user rights.

Let's say the site contains both a public site and a nonpublic extranet. User A is the webmaster for the whole site while User B is editor only for the extranet.

When User A logs into EPiServer edit mode he should see all the pages in the tree, just as it works by default. But when User B logs in, he should only see the pages that he's got editor rights for.

Example

This is the tree structure.

Root
- Waste basket
- Web
  - Home
  - Products
  - ...
- Extranet
  - Start
  - Marketing
  - ...

When User B logs in, the structure should look like this:

Root
- Waste basket
- Extranet
  - Start
  - Marketing
  - ...

So, does anyone have a solution for this?

Thanks in advance!

#25127
Oct 14, 2008 14:40
Vote:
 

You could build a HttpModule which subscribes to DataFactory.Instance.FinishedLoadingChildren. In this event you can make whatever checks you like and remove (hide) pages as you see fit.

Some thing like:

private void Instance_FinishedLoadingChildren(object sender, ChildrenEventArgs e)
{
   for(int i =0; i<e.Children.Count;i++)
   {
      if(e.Children[i].PageName == "Extranet")
      {
         e.Children.RemoveAt(i);
         return;
      }
   }
}

edit:

If you're using EPiServer CMS 4, it's Global.EPDataFactory.FinishedLoadingChildren.

#25205
Edited, Oct 15, 2008 10:39