+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Create Child Page under own pages only

Create Child Page under own pages only

2 posts, 0 answered
  1. Arjan
    Arjan avatar
    5 posts
    Registered:
    09 Jun 2006
    17 Nov 2014
    Link to this post

    Hi,

    I'm setting up the security for a new site and I want a setup so users can create and manage pages in a section of the site. When I grant the 'Create Page' right then the user can create sub pages under all pages by default. I want the user to be able to create child pages only under the pages he or she owns. I don't want to break the inheritance of the page permissions on all root pages just to prevent users from creating child pages under other pages then they own. Can this be done?

    Regards,
    Arjan Vermunt

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    15 Dec 2014
    Link to this post
    Hello Arjan,

    This could be achieved by extending the pageservice and filter the pages it returns (you need to take care when a user dargs&drops a page in backend list view or when he create / edit /duplicate a page using the create / edit / duplciate dialog):

    Add a custom page service:
    • include PageServiceExtended.cs in your solution (please find it attached in this reply)
    • include PageServiceExtended.svc in ~\Sitefinity\Services\Pages\PageServiceExtended.svc
    • build the solution
    • go to Administration >> Settings >> Advanced >> ContentView >> Controls >> FrontendPagesListView, under  WebServiceBaseUrl type the new one: ~/Sitefinity/Services/Pages/PagesServiceExtended.svc/
    • go to Administration >> Settings >> Advanced >> ContentView >> Controls >> FrontendPagesCreate (same also for FrontendPagesEdit and FrontendPagesDuplicate) >> Sections >> MainSection >> Fields >> Parent, under  WebServiceBaseUrl type the new one: ~/Sitefinity/Services/Pages/PagesServiceExtended.svc/
    • restart the application
    After performing the above, all requests for create, edit, duplicate and list view will pass trough your custom page service. What is left is to put a custom code to filter the result accordingly. You need to plug custom logic on two places:
    public Telerik.Sitefinity.Web.Services.CollectionContext<Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageViewModel> BatchPlacePage(string[] sourcePageIds, string providerName, string placePosition, string destination, string root)
    {
        return pageservice.BatchPlacePage(sourcePageIds, providerName, placePosition, destination, root);
    }

    and

    public Telerik.Sitefinity.Web.Services.CollectionContext<Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageViewModel> BatchPlacePage(string[] sourcePageIds, string providerName, string placePosition, string destination, string root)
    {
        return pageservice.BatchPlacePage(sourcePageIds, providerName, placePosition, destination, root);
    }

    In both methods you have to perform additional check if

    var identity = ClaimsManager.GetCurrentIdentity();

    is in specific role or is an owner of each page the service returns and if needed to be filtered out.

    Hope this helps.

    Regards,
    Vassil Vassilev
    Telerikabout:newtab
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered