10

Is it possible to load different default Rich Text Editor profiles (default for most users but the "full" for a select few) based on Sitecore Roles a user belongs to? For example, if a user is in the "Reviewer" role, we give them the full editor - while everyone else gets the default.

9

Yes you can do it.

You can customize the constructor of the EditorConfiguration class: You can use Reflector, IlSpy or .Peek or any disssamble tool to investigate the code.

Here is example of the constructor:

public EditorConfiguration(Item profile)
{
    Assert.ArgumentNotNull(profile, "profile");
    this.Result = new EditorConfigurationResult();
    if (Sitecore.Context.User.Roles.Contains (new Sitecore.Security.Accounts.Role("roleName")))
   {
       this.profile = Sitecore.Configuration.Factory.GetDatabase("core").GetItem(Id of the item profile in the Core database);
    } 
    this.profile = profile;
}

Sitecore determines the configuration type for the Rich Text Editor:

  1. Sitecore retrieves the profile of the current Rich Text Editor field (e.g. Rich Text Medium);
  2. It then goes to the Core database and looks the children of the profile item;
  3. If Sitecore finds the Configuration Type item among the children, the Configuration Type in the Web.config will be ignored.

In conclusion (make the solution to work for the Rich Text Default type): In the Core database navigate to the /sitecore/system/Settings/Html Editor Profiles/Rich Text Default/Configuration Type item and configure there your custom configuration type too.

P.S. Profiles can be found in Core database under the /sitecore/system/Settings/Html Editor Profiles item

| improve this answer | |
3

The solution from @Sitecore Climber is robust, but if you are looking for a quick-and-dirty solution, you can analyze your role capabilities and look for subsets of capabilities.

If all your users are subsets of each other, you define a new HTML Editor Profile in the Core database and then update the HtmlEditor.DefaultProfile setting to use your custom profile.

In the Core database, you can then group the buttons of the profile into toolbars for different roles and secure with Sitecore security. This will allow you to open up more functionality based on role using a single profile.

An example of this described in this blog: http://bluetubeinc.com/blog/2012/9/limiting-sitecore-rich-text-editor-buttons-by-security-role

Rich Text Editor configuration is stored in the Core database at/sitecore/system/Settings/Html Editor Profiles. Rich Text Default is the default configuration. You can override this on any Rich Text Field by pointing to a different location.

If you use multiple profiles, you'll need to apply this to all of them, but to keep things simple I will be focusing on just the default.

Open the Security Editor and select the role you wish to edit. In this example, I'm going to use the Author role.

Navigate to the path above in the Core database.

Browse to the toolbars. In this example, I'm using the default, so there is a single toolbar. In the full (which is commonly renamed and used), there are three. First, turn off item inheritance, then apply Read Permissions to the buttons you wish to show in the toolbar. All other buttons should have their inheritance turned off.

If you want to turn off an entire toolbar, simply remove the inheritace from the toolbar - you do not need to turn off or change permissions on individual buttons unless you only want to show buttons within that toolbar.

Final note- you can use the deny read rather than inheritance and allow. This is typically much faster. However, keep in mind in Sitecore that deny reads win out over allows. So if a user is in a role with a Deny and a role with an Allow, they will not be granted permissions.

Another example described in this SO post: https://stackoverflow.com/questions/10434054/in-sitecore-how-do-i-assign-an-html-editor-profile-to-a-user-or-role

Just have one profile that includes everything, but deny everyone read or break security inheritance. Then admin has everything and everyone else has nothing. Add rights for the various roles as required. This involves using the Security Editor and drilling down in the core database to:

/sitecore/system/Settings/Html Editor Profiles//Toolbar 1/ /sitecore/system/Settings/Html Editor Profiles//Toolbar 2/ /sitecore/system/Settings/Html Editor Profiles//Toolbar 3/

...and denying "Read" rights for user roles.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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