Prevent users from editing Shared Layout

Recently, there was a question in Sitecore Stack Exchange asking whether we can prevent users from editing renderings under shared layout. The requirement was that the users should be able to see the shared layout rendering list but should not be able to perform edits like add or remove renderings.

This article outlines the research and steps I have taken in order to handle it.

The default view for the list of renderings gives us an option to open and edit a rendering. This is handled in the RenderLayoutGridBuilder method located inside Sitecore.Shell.Applications.ContentManager.Dialogs.LayoutDetails.LayoutDetailsForm.

    /// Renders the LayoutGridBuilder.
    /// The layout value.
    /// The rendering container.
    private void RenderLayoutGridBuilder(string layoutValue, Sitecore.Web.UI.HtmlControls.Control renderingContainer)
      string str = renderingContainer.ID + "LayoutGrid";
      LayoutGridBuilder layoutGridBuilder = new LayoutGridBuilder()
        ID = str,
        Value = layoutValue,
        EditRenderingClick = "EditRendering(\"$Device\", \"$Index\")",
        EditPlaceholderClick = "EditPlaceholder(\"$Device\", \"$UniqueID\")",
        OpenDeviceClick = "OpenDevice(\"$Device\")",
        CopyToClick = "CopyDevice(\"$Device\")"
      layoutGridBuilder.BuildGrid((System.Web.UI.Control) renderingContainer);
      if (!Context.ClientPage.IsEvent)
      SheerResponse.SetOuterHtml(renderingContainer.ID, (System.Web.UI.Control) renderingContainer);
      SheerResponse.Eval("if (!scForm.browser.isIE) { scForm.browser.initializeFixsizeElements(); }");


Create a copy of this class in your local assembly and update the CodeBehind for the LayoutDetails xml control located under ~\Website\sitecore\shell\Applications\Content Manager\Dialogs.

If you want to restrict users in a particular role from editing renderings under Shared Layout, there are two things we need to check:

  1. Check if the layoutValue is for Shared Layout renderings
  2. Check if the Sitecore.Context.User is a member of your custom role.

If both of these conditions are true, we will update the method to set EditRenderingClick and OpenDeviceClick to string.Empty.

After compiling your changes, you will notice that users in that custom role will not see an option to open or edit renderings.


This has been tested and verified on Sitecore Experience Platform 8.1 Update 3.

As always, please test these changes on your development environment before applying it on Production.

Tags: Sitecore;