TinyMCE editor (v2) and roles


Is it possible to configure TinyMCE editor to display options based on user roles?

Jun 27, 2019 12:09

Yep. Luc Gosso put together a blog post explaining how you can limit the available buttons in TinyMCE by user role. You can read it here:

Jun 27, 2019 12:55

Hi, it is also possible to use the TinyMCE configuration API: AddSettingsTransform.

For example you could add the "code" button (view HTML source) to the toolbar if the current user is in role "WebAdmins" like this:

config.Default().AddSettingsTransform("sample-add-code-button", (settings, content, propertyName) =>
	var user = HttpContext.Current?.User;

	if (user !=null && user.IsInRole("WebAdmins"))
		settings.AppendToolbar("| code");
Jun 29, 2019 16:19
Paul Gruffydd - Jul 02, 2019 13:10
Nice! That's a handy technique I wasn't previously aware of but I'm sure I'll be using it in the future.
* 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.