SaaS CMS has officially launched! Learn more now.

TinyMce button only for a specific role


I would like to add a toolbar button to TinyMce (EPiServer.CMS.TinyMce 2.8.0) that is only visible for editors with a specific role. I have solved this by adding this simplified code to an initialize module:


.Toolbar($"bold italic-only-for-super-editors")

In my editor descriptor for XhtmlStrings I simply replace all icon names with the suffix '-only-for-super-editors' with the prefix if the user has the specific role, otherwise I just remove this icon. This will solve my problem.

But, this solution feels ugly. Is there a more beutiful solution?

Nov 26, 2019 14:52
Nov 26, 2019 15:57
Fredrik - Nov 27, 2019 9:40
Works great, thank you!


You can use below code snippet in the initialization module-

if (PrincipalInfo.CurrentPrincipal.IsInRole("administrators"))
                //Chance to personalize. Let's allow administrators to access the html editor.

Edited, Nov 26, 2019 16:13
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.