Add per Macro Permissions

Hi, I am currently looking for a way to assign an authorisation to some of the macros. (Currently there are only authorisations for programming?).
For example, I like to use the iframe macro to integrate external diagrams. But of course I don’t want everyone to use this macro. https://extensions.xwiki.org/xwiki/bin/view/Extension/Iframe%20Macro
How can I now say: Hey, you need these group authorisations for this macro? This would also be really useful for your own macros: https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingMacros/WikiMacroTutorial/

Hello, in the future we’d like to implement Add concept of required permissions for Macros

For now, what I can propose to you is to:

  1. create a wiki macro that wraps the iframe macro and adds a permission check (using the scripting api for that)
  2. Categorize the iframe macro so that it’s hidden. See https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HMacroscategoriesandvisibility

Now one issue is that a knowedgeable user could still use the iframe macro even if it’s not listed anymore in the UI (hidden), but maybe it’s enough for your use case.

The alternative is to not install the iframe macro and re-implement it as a wiki macro with a permissions check. Since it’s a very simple macro, that should be very easy (I think it’s already a wiki macro so you could even copy its implementation).

1 Like

Sorry for the late reply, I was on holiday and then enjoyed my time without a computer.
The concept is of course a cool idea :). But the workaround is also a good idea and is completely sufficient. In general, the macro is only used by the administrators (i.e. me) to display content from other pages directly. And writing your own iframe macro is a minimal effort.
Thanks you :slight_smile: