How to disable installation of new macros from WYSIWYG?

Hello friends!

Please, need some advice!

Can I turn off prompts to install new macros from WYSIWYG, so they don’t appear in the list?

Causes:

  1. not installed macros confuse users and complicate searching through the list.

  2. the ability to install macros outside the administration section carries a risk.

An incident occurred in my organization - a user who did not have administrator rights, but had programmer rights, was able to install an extension from WYSIWYG. As a result, the commercial Diagram Pro extension was installed next to the free Diagram extension and damaged it. After uninstalling the Pro version, the free version stopped working and could not be restored.

As a result, we had to restore XWIKI from a backup. A lot of nerves and time were spent.

If installing extensions had been possible only from the administration section, accessible only to users with administrator rights, such an incident would not have happened.

I want to disable the display of not installed macros in the list in WYSIWYG, so as not to confuse users. And want to disable the installation of extensions from WYSIWYG.

How can I do it? Maybe there is a setting?

I will be grateful for the advice

1 Like

As a few of our users are also admins, we also had this problem multiple times that they wanted to insert the installed pdf viewer macro and accidentally started the installation of the Pro version…

If possibile I too would really like to limit it, so non installed extensions can only be installed via the Admin GUI.

1 Like

As far as I can see, there is no way to configure this. However, you can edit CKEditor.MacroService with the wiki editor (e.g., press Ctrl + G, copy & paste the name CKEditor.MacroService, click “View” and then select the “Wiki” editor in the dropdown next to the edit button and confirm the warning) and comment out line 153 by replacing #set in #set ($discard = $data.put('notinstalled', $macroExtensionsList)) by ##set. Make sure you perform this change with an account that has admin rights on the wiki or this will completely break macro listing. Here is the diff of this change:

image

Note that this could cause conflicts on a future update in case this line or an adjacent line is changed in a future version of XWiki and you won’t get the installation of new macros from WYSIWYG back without reverting the modification. You can undo your modification any time by choosing the “Rollback” option in the first line of the history that says “Version coming from extension”:

image

2 Likes

Thanks for the advice!
I was hoping it would be easier. I think it would be nice to add the setting to the administration section

See also Loading... (contains a workaround)

1 Like

Thank you, Vmassol!
As I understand from the documentation, in the xwiki.properies file we can set macro categories to hide from the list.
In this line:

> # rendering.transformation.macro.hiddenCategories = Development,Internal,Deprecated

This means that I can add a category name to this list for not installed macros and they will disappear from the list in the WYSIWYG selection window, right?
If so, what is the correct name for the category for uninstalled macros? I tried adding “Not installed” there, but it didn’t work.

Right now, the “not installed” label displayed is not a category and it’s thus not filterable with rendering.transformation.macro.hiddenCategories. It could be nice to refactor it as a dynamic category when implementing Loading...

It’s a pity.
I tried the recipe from MichaelHamann (thanks Michael !!!) - it worked. But I don’t like the possible negative consequences in the future when updating the platform. Ideally, it would be nice to be able to disable this feature in the administration section.