November Happy Hour will be moved to Thursday December 5th.

Disable page move and delete for editors with access to a single language version

Vote:
 

There is a possibility to restrict editors create/edit access to one or more specific languages in Episerver. But move/delete actions can't be restricted, so editors still can move/delete entire page including all descendants if they have create/edit access to any language version of a page.

This is a usual demand from our customers with multi-language websites with a shared page tree, which is a powerful Episerver use case comparing to other CMS like Umbraco. If an editor doesn't have access to other language versions of a page, he shouldn't be able to move/delete the page, because he is not authorized to change content/structure in other languages.

#154907
Sep 01, 2016 12:42
Vote:
 

Thanks for the feedback. Are you looking to have a separation between people who can change the contents of a page, and people who can modify the structure of a site? In other words, do you also see a need to have people that can modify all language content, but never move pages around?

#155029
Sep 07, 2016 19:19
Vote:
 

Hi Martin. There is a possibility to do that by disabling "Delete" access to such editors, so they would be able to edit content, but not changing the structure or delete pages. But our usual case is each country has its own editor who manages all content and structure for one language. And the problem that these editors still can occasionally change structure or delete pages in other languages.

Currently I'm using page "Moving" event handler to restrict access, but I think logically this should work out-of-box:

var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
contentEvents.MovingContent += Events_MovingContent;

private void Events_MovingContent(object sender, ContentEventArgs e)
{
    if (!(e.Content is PageData))
    {
        return;
    }

    var languages = ServiceLocator.Current.GetInstance<ILanguageBranchRepository>();
    var versions = ServiceLocator.Current.GetInstance<IContentVersionRepository>();

    var pageVersions = versions.ListPublished(e.Content.ContentLink);
    var pageLanguages = languages.ListEnabled()
        .Where(lb => pageVersions.Any(v => v.LanguageBranch == lb.LanguageID))
        .ToList();

    if (pageLanguages.Any(lang => !lang.ACL.QueryDistinctAccess(AccessLevel.Edit)))
    {
        var action = e.TargetLink == ContentReference.WasteBasket ? "remove" : "move";

        e.CancelAction = true;
        e.CancelReason = $"You can't {action} the page, because it contains other language versions you don't have access to.";
    }
}
#155242
Sep 13, 2016 9:47
Vote:
 

Thanks for sharing that snippet. So if I understand correctly, you have a single content tree shared by multiple country sites, where every country manages their own variation of the structure. Re-using some of the shared structure, and in places overriding with their own structure?

#155271
Sep 13, 2016 11:53
Vote:
 

Yep, exactly. We have a master site in English with general structure and country editors translate existing main pages, but countries also have unique pages and sections.

#155273
Sep 13, 2016 12:01
Vote:
 

That makes sense, and it's a pattern I see used often so would like to support it better. Nothing on the official roadmap yet though.

#155279
Sep 13, 2016 13:09
This thread is locked and should be used for reference only.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.