Create Child Page under own pages only
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
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:
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