Disable constructive role programmatically
1 answer
The code below toggles the state of this parameter for the current user. It should work for you, or at least point you in the right direction. I didn't have time to test it, so you have to do it yourself. Don't forget to refresh the page after running the code:
string key = "/Current_User/Page Editor/Capability/design";
if (Sitecore.Web.UI.HtmlControls.Registry.GetString(key, "on") == "on")
{
Sitecore.Web.UI.HtmlControls.Registry.SetString(key, "off");
}
else
{
if (WebEditUtil.CanDesignItem(Sitecore.Context.Item))
{
Sitecore.Web.UI.HtmlControls.Registry.SetString(key, "on");
}
}
+2
source to share