I'm writing a macro to create a list of pages that don't have permissions set within spaces. I'd like to make the macro such that if it resides in a page in a specified space, it lists pages from all spaces that are unrestricted, but if in any other space, it will only show pages from that space.
What is the easiest way to find out what space the macro is being used in?
(This is all based on not being able to find an existing way to list unrestricted pages.)
Community moderators have prevented the ability to post new answers.
This should start you off -- assumes that all your logic goes in the Macro's execute method
public String execute(Map params, String body, RenderContext renderContext) throws MacroException
{
ContentEntityObject contentEntityObject = ((PageContext) renderContext).getEntity();
Space space;
if (contentEntityObject instanceof BlogPost) {
BlogPost blogPost = (BlogPost) contentEntityObject;
space = blogPost.getSpace();
}
else if (contentEntityObject instanceof Page) {
Page page = (Page) contentEntityObject;
space = page.getSpace();
}
// Now do stuff with the space
// ...
}
@Derrick Bommarito: Does this answer your question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.