Automatically display an "Internal Only" warning based on page permissions

I'm building a knowledge base which will contain 'internal only' articles that should not be readable/searchable by anonymous users.

To achieve this, 'internal only' documents will be restricted in view for anyone but internal people.

Is there any way (user macro) to display a panel depending on the page restrictions ?

Thank you.

Pierre

2 answers

1 accepted

You can get a list of a page's permissions by doing this:

#set($permsList = $content.permissions)

This sets permsList to an ArrayList of com.atlassian.confluence.security.ContentPermission objects (with type, userName, groupName properties). You can then iterate over it and draw your panel based on a particular value as you would any ArrayList.

hth,

matt

Thank you very much. This is what I was looking for (although I'm not used with the macro creation, I'll give it a try)

No problem. Feel free to ask more macro-related questions.

Hi Pierre,

Judging from your query you would want to hide some section of a page from anonymous users, if that is the case, you might want to use ServiceRocket Visibility Plugin. The plugin will allow you to hide a section of a page which could be a warning.

Hope it helps.

Cheers,
Septa Cahyadiputra

Your suggestion would make a section appear based on the viewer permissions.

I'm looking on a way to make a section appear based on the page permissions.

Thank you anyway for your time.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

86 views 0 6
Read article

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