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.
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.
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
Developer documentation has now been updated. Sorry we missed this first time around.
@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!