This plugin contains macros which allow you to show or hide content based on a users name, groups or space access.
Overview
Details
Versions of this plugin prior to 1.5 require the appropriate Utilities Plugin to be installed into WEB-INF/lib.
This plugin contains macros which allow you to show or hide content based on a users name, groups or space access.
 | Warning These are not security macros! They do effectively block the content when the page is viewed directly, but the whole page text is indexed and will show up unrendered in page summaries, as well as being visible by viewing the page source from the Page Info view. |
What are these macros for then? They are very good at customising a page depending on who is looking at it. This is useful for determining if a visitor is logged in or not, belongs to a certain group, or has permission to edit the space.
For example, a page in SPACEONE may have a reference to a page in SPACETWO. If there is a user that can view SPACEONE, but can't access SPACETWO, then the link will just be an ugly red unrendered piece of text.
To view the macro's documentation, click on its name below.
This will only show its contents to a user that matches the users, groups or space-viewability specifications listed. more info...
This macro will show its contents to the viewer if the context matches the parameters specified. more info...
This macro will show its contents to the viewer if the context matches the parameters specified. more info...
This will only show its contents to a user that matches the users, groups or space-viewability specifications listed. more info...
Below are listed some recipes which make use of this plugin. They are often good examples of how it can be used in real-world situations.
Includes the wiki content of all children of a page, headed by the page title and a link to edit the page. more info...
For information on installing the plugins once you've downloaded them, see these instructions.
Confluence 2.3-2.6
This is the version to install if you are using Confluence 2.3 or above.
Confluence 1.4/2.0/2.1/2.2
This is the version to install if you are using Confluence 1.4, 2.0, 2.1 or 2.2.
Confluence 1.3
This is the version to install if you are using Confluence 1.3.
 | Note
- This plugin is no longer maintained.
|
Bug reports and feature requests are available in JIRA.
Frequently Asked Questions about this plugin.
How can I make a context invisible in edit mode for everyone users except members of the group 'my-group'?
I think a combination of show-to and show-if will do the trick. Eg:
{show-to:group=my-group}{show-if:action=edit}Only display this to users in 'my-group' in edit mode.{show-if}{show-to}Sorry, this is not exactly what I needed. I need to hide part of the text when other users in edit mode. But the text must be seen in the viewing mode.
So, other viewers can see the text when viewing, but not in edit mode? Could you just put the text twice, once in a {show-if:action=view} and the other in the above example? I'm not sure there is a way to have a single macro which only hides when display is edit mode and the user is not in a specific group. Mostly that's because the two tests are in separate macros. Theoretically you could just have one macro for both, but it doesn't work that way presently.
I need to include an image into the page if it is created by a specific user. does not have a user parameter. Any suggestions? Thank you much,
This plugin doesn't really check on page content variables. You could do something with the Reporting Plugin, along these lines:
{report-block} {local-reporter} {user-filter:content:creator|user=specific_user_name} {local-reporter} {report-block}!//link/to/my/image!{report-block} {report-block}we need some v1.60 features on confluence 2.5.7. The upgrade is not available. Are these version NOT compatible, or just NOT tested. If it's the latter, can we test it, please?
I'm not sure what version 1.6.0 was compatible with. However, 1.6.0 had a couple of serious bugs which is why it's not listed at all in the plugin repository. 1.7.0 may work in earlier versions of Confluence, but it does depend on libraries which contain code which is incompatible with earlier versions, so we upped the requirements based on that. It's possible that none of the functionality used is incompatible however.
If you want to test it out, go ahead - the worst that can happen is that you have to uninstall 1.7.0 and possibly restart your Confluence server.
Let me know how it goes.
Updated by Christian Nesemann
Aug 22, 2008 00:28
So first question to this plugin:
I have created a usermacro which gets me the text out of a text-data field and transform it into a link or an email-link.
Works fine alone but when i put this macro between a {hide-if:action=edit} macro only text is shown not a link.
What do i have to change to get this to work?
regards Christian
Make sure you have Visibility 1.7.0, not 1.6. The latter has some nasty bugs when dealing with contained macros.
Otherwise, I'm not sure. Your use of {report-info} is quite unusual - I haven't tried putting a macro into a [link] markup before...
hi,
it's 1.7.
I do often unusual things
Btw. putting a reporting-macro within [] works fine. Before that i used the get-data macro .
I already tried something with $action.helper.renderConfluenceMacro(" ") but it didn't seem to work. Either with report-info (cause of no context) nor {get-data}
I also read on atlassians velocity help pages but it seems that renderConfluenceMacro has problems with some macros
Visibility rides out on the edge of what the renderer lets macros do in its efforts to essentially be invisible if the contents is not being rendered.
Probably the best thing is to create a bug report with the full details of your user macro and use of visibility macros and we'll see what we can come up with...
ok created an entry
so 17:14 here ... end of workday!
Show to "Anonymous"
We have just installed the Visibility Plug In. I want to display a line to Anonymous users to make them aware of them not being logged in. I'm using:
{show-if:user=Anonymous} You are not LOGGED IN {show-if}but it is not working. What am I doing wrong?
You need the show-to macro to filter based on users. As indicated in the macro [documentation|show-to}, use the special '@anonymous' value to match to anonymous users. You can also use '@authenticated' to match the converse scenario.
Thanks for the quick reply. I'm using:
{show-to:users=@anonymous} \*You are not LOGGED IN\* {show-to}and it is working now. Thanks for pointing me to right place for quick reference.