0

I need to configure Role-based access for the Placeholder settings section, how to achieve this?

Any suggestion would be helpful.

enter image description here

2 Answers 2

1

Thanks @Marek, your suggestion got worked out.

  • Check DeviceEditor control (sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml)
  • Change CodeBeside to your custom class inheriting from the original Sitecore.(Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm)
  • Overwrite OnLoad method to hide PlaceholdersTab from the DeviceEditor.xml

Here is the custom logic to restrict the access to specific role:

public class DeviceEditorForm : Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm
{
    protected override void OnLoad(EventArgs e)
    {
        Assert.ArgumentNotNull(e, "e");
        base.OnLoad(e);
        if (!Context.ClientPage.IsEvent && Sitecore.Context.User.IsInRole(ContentAuthor))
        {
            Placeholders.Visible = false;
        }
    }
}
0

As far as I remember there is nothing like that out of the box

You would need to:

  • check DeviceEditor control (most probably it's sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml)
  • change CodeBeside to your custom class inheriting from the original Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm
  • overwrite OnLoad method to hide PlaceholdersTab from the DeviceEditor.xml.
2
  • Hi @Marek , Thanks for your suggestion, I tried multiple ways to hide "PlaceholderTab" I couldn't achieved it. Could share me a code snippet to Hide the "PlaceholderTab", if you have?
    – Bharath
    Commented Feb 1, 2022 at 9:32
  • I've never done that on my own. You can edit your question and add the code you tried with. Maybe someone will be able to help you
    – Marek Musielak
    Commented Feb 1, 2022 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.