ContentPermissionManager.setContentPermissions does not persist data

Using Confluence Server API 6.15.4.

  • Attempting to remove Page ContentPermissions based on user.
  • I’m retrieving ContentPermissionManager using the ContainerManager.
  • No errors happen when I call setContentPermissions with a map of ContentPermissions and the Page as parameters.
  • The first subsequent call to getPermissionSets shows that the correct changes have been made to the Page.
  • The second call to getPermissionSets shows the Page’s original ContentPermissions. The data was never persisted.

Is this a scope issue? Am I using the wrong method? Does the test environment just have issues persisting this data for some reason?

Hi @chu - so, you’re calling getPermissionSets after the set call, and it’s showing the permission updates? But… as soon as you make a second getPermissionSets call, it reverts? Can you send details about the set call you’re making?

Let me know if you’re still seeing the problem, and if so, I’ll see if someone here can reproduce it.

Yes, that’s correct. I tested my plugin in a full instance of Confluence Server as well and the same thing happened.

For ContentPermission.EDIT_PERMISSION and VIEW_PERMISSION.

  1. Call getContentPermissionsCopy on the Page permission set to obtain current ContentPermission of each type, then I add all of them to separate Collections.
  2. Call contains() on the permission set with an edit/view ContentPermission created for the user, remove from the new Collections if found.
  3. Create a map of ContentPermission for ContentPermission.EDIT_PERMISSION and VIEW_PERMISSION using the Collections I created.
  4. Call setContentPermissions(Map, Page).

hello.
Did you solve your problem?