Include restricted content with excerpt include macro

Hi,

We have a space with pages that are each restricted to a group of users. A user can have access to more than one page of that space. On the space main page, I want to list the contents of the pages that the user has access to. I use the excerpt macro on the page and the excerpt include macro on the main page.

So I have pages A, B and C and the user has access to A and B, not C.

Now on the main page I want to show contents of A and contents of B to the user.

This works great, except for the contents of page C which the user cannot access. Instead of simply not showing the content, the macro outputs "page does not exist", which obviously is not what I want.

What is interesting is that if I just want to show the pages (not the content) that a user can access on the main page, I can use the children macro and that will work fine, e.g. show only the pages that a user can access and simply leave out the ones the user cannot access.

Is there a way to achieve the same behavior with the excerpt-include macro as with the children macro, or should I use a different method?

Thanks,

Geert

1 answer

1 accepted

So I found this: https://jira.atlassian.com/browse/CONF-5436, where a workaround is given by hiding the error message using CSS. A bit ugly, but it works. You have to use the page include rather than the excerpt include, as the excerpt errors are not associated with any styling, but the page include errors come in a nice div with class error. You can probably achieve the same for the excerpt by adding styling to the page, but that is even more hacking so I use the page include for now.

I actually hope there is a better solution, but in any case there is a workaround.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

281 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you