Excerpt Include and Include Page macros cannot handle restrictions

Darren K February 17, 2016

We provide a Help and Documentation space to many customers, some are independents and others are part of large franchise chains.

Sometimes a particular customer will have our software configured differently to most and we need to add a paragraph into a page that is visible to them only.

Scenario:

Page (A) documents a procedure and is available to all of our groups. In the middle of the procedure I add an Include Page macro to include a paragraph from child page (B) that is restricted to UserX. The extra content does display correctly to UserX but instead of being invisible to all other users it displays an error to them saying "Unable to render .... page could not be found"

If I use an Include Excerpt instead, UserX can see the content correctly but all other users see an error saying "Unable to render ... user cannot view page".

Pages listed in a Children Display macro are invisible to users without access to those child pages but we don't want the user to have to jump to another page to view a paragraph and then have to return to where they were. Also, there may be multiple child pages and most are not relevant at this point in the procedure so we don't want them all listed.

Links are no good for this either as they are visible to all users regardless of whether the user has access to the linked pages or not. And again, we don't want users to have to follow links to view a paragraph and then have to find their way back to where they were again. This could happen several times within a procedure.

This seems a pretty basic function but I can't see how to make it work in Confluence.

Is anyone able to advise me please?

 

Thanks,

Darren.

 

 

 

3 answers

1 vote
Arjen Breur November 1, 2018

This user macro "wraps" the default _Insert Page_ macro and only shows it if the current user has permission to view that page. It does not show anything if the user doesn't.

## Macro title: Include Restricted Page
## Date created: 01/11/2018
## Macro has a body: N

## @param space:title=Space|type=spacekey|desc=Space where the page excerpt is found
## @param page:title=Page|type=confluence-content|required=true|desc=Page where the excerpt is found
## Check for valid space key, otherwise use current
#set($spacekey= $paramspace)
#if (!$spacekey)
#set ($spacekey=$space.key)
#end
#set($m1 = "{include:")
#set($m2 = "}")
#set($macro = "${m1}${spacekey}:${parampage}${m2}")

#if ($permissionHelper.canViewPage($action.remoteUser, $spacekey, $parampage))
$action.getHelper().renderConfluenceMacro($macro)
#end
0 votes
Darren K February 18, 2016

Thanks for you reply Thomas, but ... really?

We have to muck around adding a plugin and put macros around macros every time we want to include snippets of customer-specific information on a page (potentially hundreds of times across the documentation space) ... just to hide a superfluous error message that should not be displayed anyway as the macros are working perfectly?

The error message should be silent like it is for the Children Display macro.

The "Include Page" and "Include Excerpt" macros already recognise whether the user has access to view the included child page and correctly display it (or not) accordingly. But the extraneous error message displayed to users without access makes it look like something is broken and ruins the professional appearance of the documentation.

The Include Page and Include Excerpt macros are great but this bug makes them unusable for spaces that need to include any customer-specific information.

Are there any plans to fix this bug?

 

Thanks,

Darren.

 

Update: I just looked at the website for this plugin and the most recent version appears to be only for Confluence versions up to 5.8 (we are on 5.9.3)

 

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2016

Hi Darren,

you can look for a suitable solution or wait for Atlassian to fix your problem, it is up to you, but you asked for advise, so I answered you.

We have no problem using the visibility plugin and it is available for 5.9.5, not only for 5.8.

Thomas

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 17, 2016

Hi Darren,

you can hide the error message, if you put the "excerpt include" into an "show-if"-macro using the Visibility Plugin (https://marketplace.atlassian.com/plugins/net.customware.confluence.plugin.visibility/server/overview)

Visibility Plugin is free.

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events