Configurable hidden macros categories not working

Hi.

We are updating to 15.10.11. As I found in ReleaseNotes for 14.8RC1 there are new configurable hidden macros categories.

Therefor I looked into xwiki.properties:

#-# [Since 14.8RC1]
#-# Override the default hidden macro categories.
#-# Note: the categories are case sensitive.
#-#
#-# The default value is:
# rendering.transformation.macro.hiddenCategories = Internal,Deprecated
#-#
#-# For instance, to make the "Development" category hidden by default, in addition to the "Internal" and
#-# "Deprecated" categories, you'd use:
# rendering.transformation.macro.hiddenCategories = Development,Internal,Deprecated

What makes me wonder we have exactly this but macros with category Internal or Deprecated are nevertheless visible. Shouldn’t they be invisble as this is the default or should this be the default when I uncomment the “default line”?

Regards, Simpel

PS: Where to fill in e.g. Hidden category inside the object at Default category(?) (Standardkategorie in german) or Default categories (yet not translated)?

No need to uncomment, it’s the default. Could you provide a screenshot of where you see this?

I don’t understand this sentence. WDYM by “object”? This is configurable in xwiki.properties using the key rendering.transformation.macro.hiddenCategories.

Thx

Can’t provide a screenshot until wednesday, as this test wiki is company internal only. But I see Internal and/or Deprecated macros in the popup where I can pick the macros and see them in quick actions too. But if I understand correctly those should be hidden by default.

As I think about it I remember that looking inside macro class object at Default category (?) (Standardkategorie in german) it isn’t Internal and/or Deprecated but shown translated Intern and/or Veraltet. Maybe there is a bug?

It is configured through the default. When I open the macro class object then I see two inputs:

  • Default categories (yet not translated)
  • Default category (?) (Standardkategorie in german)

Where should I type my Internal and/or Deprecated category to set it invisible.

This is what I see (using XWiki 16.5.0), in English:

BTW this shows that some Macro is wrongly using a content category (instead of Content, or vice-versa, I’ll check which one is the good one), since it’s displayed twice. I’ll fix this.

I’ve then switched my wiki to German and I see:

My XWiki UI is in German but it’s strange that the Macro Dialog has English text a bit everywhere… And the Categories are not translated (several seem to be missing translations and they’re displayed in lower case I think).

I see no Internal nor Deprecated categories but I’ll check the code to see if the check is done on the translation.

The singular xproperty has been deprecated and removed, the xobject editor should probably show a warning about deprecated properties and you should clean it.

Thanks

The right one is Content. It’s the MathJax Macro that had a wrong category. I’ve fixed it with Loading...

More precisely:

hmm OTOH, if you remove the defaultCategory then you loose the macro category. It just happened to me for the MathJax Macro… That’s not good, I thought we were supposed to have a migration, cc @mleduc

ah I think I know what’s happening, it seems that right now:

  • We list all macros in the Macro picker
  • We only list categories that are not hidden in the category selector

This means that Macros in hidden categories are listed when listing all macros (ie when no category is selected).

I think this was done voluntarily but indeed it can be seen as a bug especially when you want to use the hidden category config to prevent users from selecting macros!

This is what I have locally for example:

Notice the deprecated macro listed!

I’ll discuss it with the committers.

According to https://design.xwiki.org/xwiki/bin/view/Proposal/MacroVisibilityControl:

The goal of this feature is to allow administrators and macro developers to limit the use of some macros by hiding them in the UI. Note that the goal is not to strictly disallow their use, and this is not a security feature. Knowledgeable user will still be capable to use any hidden macro by writing in xwiki syntax for instance.

Thus, it seems like a bug to me.

ok so it’s not a bug, it’s a feature. When the user you’re using has selected “show hidden pages” then it also sees hidden macros.

2 Likes

I’ve now documented it at:

1 Like

@Simpel could you confirm that your issue is because your user is viewing hidden pages? Thx

1 Like

I can confirm that. Did forget that I had temporarily switch to see hidden pages.

Btw this is my macro popup looking like:

Most of it is translated.

This is how an object of type MacroClass is looking like:

The red one is deprecated? I should use the green one? How to type in more then one category? Should I split them with a space or a comma? How to type in a category including a space like “Not Installed”?

Btw: I can’t find the field for translating “Default categories” in weblate. Did I miss something or is it just not existing?

Not sure what is the red one. I see only 1 such field in my 16.10.1 instance (the plural one):

You can always refer to the xclass def to know this → http://localhost:8080/xwiki/bin/view/XWiki/WikiMacroClass

So pipe or comma.

Example: Not Installed|Other Category

Not sure where this is.

It’s still there in 15.10.13.