I can think of 2 ways:
- Using JS in a JSX to change the link display based on some rights check. JS would need to call a REST api or a wiki page to perform the rights check
- By creating a component that implements
XHTMLLinkTypeRenderer
with hintdoc
and with a priority higher than1000
(in order to override the default component we provide). The default implementation is here: xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/link/DocumentXHTMLLinkTypeRenderer.java at fdc91b7a5e94c04e0fab1c714d40a7c1307986d4 · xwiki/xwiki-rendering · GitHub (and the method that would need to be modified is xwiki-rendering/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/link/DocumentXHTMLLinkTypeRenderer.java at fdc91b7a5e94c04e0fab1c714d40a7c1307986d4 · xwiki/xwiki-rendering · GitHub). More precisely you’d check rights and use a different SPAN CLASS if the user doesn’t have the permission. Then you’d style this in CSS.
Also note that I find this use case to be interesting so you could also raise a jira at Log in - XWiki.org JIRA as an improvement to provide this feature by default.