Hello,
I am using the v2 search manager to retrieve the content objects within a space. I followed this example in your documents, and the example works fine. However, I have an issue with constructing the SearchFilter
object with the SiteSearchPermissionsSearchFilter
object.
The example lists this line of code
SearchFilter searchFilter = SiteSearchPermissionsSearchFilter.getInstance();
and it even clarifies it in the comments:
Please ensure you include com.atlassian.confluence.search.v2.searchfilter.SiteSearchPermissionsSearchFilter in your search. This is a bundled filter that will handle permission checking and content filtering automatically for you.
However, in my implementation getInstance() is already deprecated, and your javadocs mention it here and suggest using the constructor with passing these 4 objects:
SiteSearchPermissionsSearchFilter(UserAccessor, SpacePermissionsFilterDao, SpacePermissionQueryManager, PermissionManager)
So, I tried using the new above constructor, however, I can’t install my plugin mainly because of the SpacePermissionQueryManager
.
I get error messages in my logs like osgi constraints, missing requirments, and OBR resolver has 1 unsatisfied requirements for installing etc…
e.g.
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle net.myCompany.confluence.plugin.myPlugin [285]: Unable to resolve 285.0: missing requirement [285.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.confluence.impl.security.query)
I tried every trick I know with modifying my OSGI imports but it won’t work. I did notice in the code that the interface for the SpacePermissionQueryManager
is marked with @Internal
annotation.
What suggestions are there to implement this permission Search Filter?
A second question, I also tried to experiment with ContentCategorySearchFilter to filter the search to only content objects of pages and blogs (and ignore attachments) but that one is also marked @Internal
. How can I add a filter for the search query based on category of content?
Side note: Even when I use the deprecated method getInstance
which has no implementation as far as I can see, the searchManager actually returns the correct objects filtered for permissions. Is there a secondary permission manager implemented in the background?
Thanks a lot for your help