Hi there,
We have a plugin that provides REST API for setting content permissions.
Previously, with Confluence 7 we used ContentEntityManagerInternal
in conjunction with ContentPermissionManager
:
ContentEntityObject contentObject = contentEntityManager.getById(ContentId.of(pageId));
...
contentPermissionManager.setContentPermissions(resultingPermissionsMap, contentObject);
Now we are getting ready to upgrade to Confluence 8.5. The problem we faced is, ContentEntityManagerInternal
seems to no longer be available, failing with:
Unsatisfied requirement: (&(package=com.atlassian.confluence.internal))
Probably, due to this:
com.atlassian.confluence.internal (Atlassian Confluence 6.2.0 API) - Internal interfaces that are NOT exposed to the plugin classpath, by being excluded in the packageScanningConfiguration of bootstrapContext.xml. This allows us to slowly reduce the surface area of confluence-core as an API, now that we are intentionally exposing an official API in confluence-java-api.
The suggested way of getting content by ID seems to be using the ContentService
, so we figured this would do the job:
Content content = contentService.find()
.withStatus(ContentStatus.CURRENT)
.withId(ContentId.of(pageId))
.fetch()
.orElseThrow(notFound("No content found with id : " + pageId));
And it does! The problem is, it returns the com.atlassian.confluence.api.model.content.Content
object, while ContentPermissionManaget
expects com.atlassian.confluence.core.ContentEntityObject
.
So, we need either a way of getting a ContentEntityObject
some other way, or set permissions some other way.
I would appreciate any suggestions on how to do this using the current Confluence APIs.