Confluence 6.10 EAP released

Probably @ttranminh can help with that

Hi @ttranminh,

Same issue as @candid here. Applying the annotation in the following way keeps returning “false” despite the user has edit permissions on the page (the call returns “true” when ROM is disabled):

@ReadOnlyAccessAllowed
private boolean canEdit(User user, AbstractPage page) {
   return permissionManager.hasPermission(user, Permission.EDIT, page);
}

In the documentation says that the annotation can be applied to methods as well as classes. We have tested it with REST resources and worked fine, but methods as the one mentioned did not work.

Is there something missing?

Thank you

Hi @candid,
Please wrap your call in the withReadOnlyAccessExemption method of the AccessModeService to bypass the Read-only mode check. I believe it will help you solve your problems. You can find it in our Javadocs:

/**
 * Execute a method that needs to be exempt from read-only access check in the permission manager layer.
 * @param callable the method
 * @param <T> the return type of the method
 * @return the value returned by the callable method
 * @throws ServiceException
 */
<T> T withReadOnlyAccessExemption(Callable<T> callable) throws ServiceException;

A similar method is also available in the confluence-compat-lib. You can use any of them.

1 Like

Hi @pablo1,
Please refer to my answer for @candid’s question. Hope that it will help you out.

Hi @sunita,
I am not sure if you have missed anything. Would you please clarify your question by saying “can’t get @ReadOnlyAccessModeBlocked annotation working”? (i.e. in which specific use case?)

I don’t think it will generate an OBR, the jar will contain all classes in the confluence-compat-lib artifact. You can try to extract your add-on’s jar file to confirm this.

Regards,
Tam

Thanks a lot, it worked! I guess I should have dived a bit deeper into the source code and would have found it myself!

You are welcome,
We will update our developer’s documentation so that everyone will know that this method does exist.

1 Like

@rw-dennis

This is certainly something which we will consider making available in the future.
The sandbox is suitable for heavy lifting or potentially unstable tasks which do not require direct access to the database. e.g. taking the contents of the page and turning into a PDF/DOC/HTML or other exportable format, Creating image thumbnails from files, extracting text from documents.

Out of interest, what tasks did you have in mind as candidates for the sandbox, bearing in mind the limitations described above?

Cheers

1 Like

Developer documentation has now been updated. Sorry we missed this first time around.

https://developer.atlassian.com/server/confluence/how-to-make-your-add-on-compatible-with-read-only-mode/

1 Like

@rbattaglin
That’s good to know. I didn’t have any specific task in mind right now, just wanted to know if the option was there if needed when optimising our apps for data center for example.
Cheers!