Confluence 6.10 EAP released

Hi everyone,

The latest Confluence 6.10 EAP milestone is available now! EAP releases provide a snapshot of our work-in-progress and give you an opportunity to test and fix your add-ons before the final release.

As usual, we’ll be releasing weekly milestones and betas during the development of Confluence 6.10, so head to Preparing for Confluence 6.10 to find out what’s changed.

Get the latest EAP

If you have any problems with an EAP release, please raise an issue to let us know. The earlier we know about problems, the more time we’ll have to fix them before the final release.

Enjoy!

1 Like

Hi @rrobins and @abarnes

are there any news on that compatibility library for read only mode?
We’re eager to get started with that one :slight_smile:

Cheers,
Jens

1 Like

Hi @rrobins / @abarnes / @ttranminh

are there any news on the read only mode and the compatibility library? I’ve seen there are several new milestones but no update on the read-only mode.

Thanks!

Hi Jens, sorry I’ve been away on holidays. I’ll get on to our dev team today and find out where this is at.

are there any news on the read only mode and the compatibility library?

Hi @jens,
I am pleased to let you know that the compatibility library is available. To use it in you add-on, you will need to do the following steps:

  1. Add a new dependency with the compile scope to your plugin’s pom.xml file as follows:
<dependency>
    <groupId>com.atlassian.confluence.compat</groupId>
    <artifactId>confluence-compat-lib</artifactId>
    <version>1.2.1</version>
</dependency> 
  1. Import the following OSGi package if you are using amps to build the plugin
<Import-Package>
    ...
    com.atlassian.confluence.api.service.accessmode;resolution:="optional",
    ...
    *;resolution:=optional
</Import-Package>

Please note that you must import it as an optional package with resolution:="optional". Otherwise, the plugin won’t work in older Confluence versions.

This library provides you the following classes/services to make your add-on conform with read-only mode:

Using the ReadWriteAccessModeCondition in a web-item or web-panel descriptor

This ReadWriteAccessModeCondition can be used to make a web-item or web-panel definition visible when the access mode is READ_WRITE (i.e. Confluence is not in read-only mode). For example:

<web-item key="awesomeWebItem" name="AwesomeWebItem" section="system.content.button" weight="150">
    <label key="i18n.label.key"/>
    <tooltip key="i18n.tooltip.key"/>
    <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.ReadWriteAccessModeCondition"/>
    <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.PagePermissionCondition">
        <param name="permission">view</param>
    </condition>
    <styleClass>customCssStyle</styleClass>
    <param name="iconClass">customIconClass</param>
</web-item>

The example above indicates that the awesomeWebItem is only visible if the user has the VIEW permission on the page and Confluence is not in read-only mode.

Using the ReadWriteAccessModeUrlReadingCondition in a web-resource descriptor

This ReadWriteAccessModeUrlReadingCondition can be used to make a web-resource definition available for download
when the access mode is READ_WRITE (i.e. Confluence is not in read-only mode). For example:

<web-resource key="awesome-resources" name="Awesome Resources">
    <condition class="com.atlassian.confluence.plugin.descriptor.web.urlreadingconditions.ReadWriteAccessModeUrlReadingCondition">
    </condition>
    <resource name="awesome-view.js" type="download" location="awesome-view.js"/>
</web-resource>

The example above indicates that the awesome-resources is only downloadable if Confluence is not in read-only mode.

Using the AccessModeCompatService

If a plugin needs to check the access mode in its logic, you can declare a Spring bean and inject this AccessModeCompatService component into a class
(preferably in a Service component, XWork action or REST resource) as follows:

<beans:bean id="accessModeCompatService" class="com.atlassian.confluence.compat.api.service.accessmode.impl.DefaultAccessModeCompatService"/>

Notes:
Another alternative is to use the Atlassian Spring Scanner library to look up this class at compile time and inject it to the caller service with the @ClasspathComponent annotation.

@Component
public class AwesomeContentService {
    final AccessModeCompatService accessModeCompatService;
    
    @Autowired
    public AwesomeContentService(final AccessModeCompatService accessModeCompatService) {
        // your awesome business logic
    }
}

Using the annotations: @ReadOnlyAccessAllowed vs. @ReadOnlyAccessBlocked

@ReadOnlyAccessAllowed

The @ReadOnlyAccessAllowed annotation is used for bypassing read-only check done when a request is served by an XWork action or a REST resource. You can add the annotation to a method, a class or a package.

For example, an action executed by a sysadmin should be bypassed in read-only mode as follows:

@ReadOnlyAccessAllowed
@WebSudoRequired
public class ReIndexAwesomeContentAction extends ConfluenceActionSupport {
    @Override
    public String execute() throws Exception {
       return SUCCESS;
    }
}
WARNING:

This annotation must be used for admin actions only or user usage tracking services, e.g. recently viewed, analytics

@ReadOnlyAccessBlocked

Normally, an action that serves a POST/PUT/DELETE request is blocked in read-only mode by default. However, it can be also blocked while serving a GET request if the action is annotated with @ReadOnlyAccessBlocked as follows:

@ReadOnlyAccessBlocked
public class ViewAwesomeContentAction extends ConfluenceActionSupport {
    @Override
    public String execute() throws Exception {
       return SUCCESS;
    }
}

If you have any difficulties while trying to use it, please feel free to let me know. I am glad to help you out.
Lastly, we are in the process of making this library open source. Please stay tuned!

5 Likes

Hi @ttranminh, thanks so much for the update and the detailed explanation :slight_smile:

We’ll look into this starting from next week and will let you know if everything went well.

The maven artifact ID looks like this is supposed to be a general compatibility library. If you’re going to add similar compatibility layers in this library in the future I can tell already that I’ll like that very much and I suppose others from the ecosystem will do as well :wink:

Hi @ttranminh,
We have tested this on Confluence 6.10 and it seems to be working ok, but we couldn’t make the annotations work on 6.8.
Should it work on 6.8 too?

Thanks!!

Hi @ttranminh,

I just tried to enable read-only mode on 6.10.0-m61 (running the tar.gz as a standalone instance with dedicated postgres DB, 100 user developer server license).

I can’t seem to enable read-only mode:

Error on UI: ‘Error! Cannot toggle read only mode’

Logs:

2018-06-04 17:57:58,934 ERROR [http-nio-1990-exec-7] [plugins.maintenance.actions.MaintenanceConfigurationAction] execute Error occurred while updating the access mode and banner {}
 -- referer: http://localhost:1990/confluence/admin/maintenance/edit.action | url: /confluence/admin/maintenance/doedit.action | traceId: a45c2f8eb743a599 | userName: admin | action: doedit
com.atlassian.confluence.api.service.exceptions.ServiceException: The instance is not a Data Center
	at com.atlassian.confluence.api.impl.service.accessmode.AccessModeServiceImpl.updateAccessMode(AccessModeServiceImpl.java:58)
	at com.atlassian.confluence.plugins.maintenance.actions.MaintenanceConfigurationAction.execute(MaintenanceConfigurationAction.java:63)

This happens with both dev mode enabled and disabled. And also regardless of whether I enable the read.only.mode dark feature or not.

Do I need to run the milestone as a datacenter instance (I was asked for a migration when I tried to install a Confluence DC timebomb license)? The EAP release notes say it’s available on server as a dark feature for now, so I just installed the milestone and set it up as a standalone instance with our server developer license.

Am I missing anything else?

Do I need to run the milestone as a datacenter instance (I was asked for a migration when I tried to install a Confluence DC timebomb license)? The EAP release notes say it’s available on server as a dark feature for now, so I just installed the milestone and set it up as a standalone instance with our server developer license.

Hi @jens,
Starting from 6.10.0-m61, the dark feature has been removed (the EAP release notes is a little bit outdated, we will update it soon). You will need to use a DC instance to test or you can spin up a standalone instance with AMPS (this instance has a special timebomb license that can be used for Data Center-only features).

You should not be able to see the Maintenance screen or toggle the read-only mode on a standalone instance. We are improving the error message on this screen as well.

Hi @hugo,
Read-only mode is only a dark feature before 6.10.0-m10 and you don’t need to test that feature in 6.8. The annotations are ignored in old Confluence versions.

The Starting a Confluence cluster on a single machine page in our developer documentation includes a 72 hour Data Center license for testing, if anyone needs one. It also has info on how to run a cluster on a single machine for testing purposes.

So sorry that I missed that the dark feature had been removed. Hope it hasn’t caused you all too much frustration.

No worries @rrobins, I got it running in the meantime with the help of your and @ttranminh’s comments :slight_smile:

The AMPS-based approach is probably the best one for use on dev machines and for automated tests.

Speaking of those, is there an API (REST / RPC) for entering and leaving read-only mode or some other way we can put an AMPS Confluence instance into read-only mode for our tests (system property maybe)?
An API would be best so we can toggle it for individual tests instead of restarting a full instance for a certain set of test cases.

@ttranminh Some more questions in addition to the previous ones above:

How should apps behave wrt. long running tasks that modify content and how does Confluence handle such long running tasks if read-only mode is enabled?

For example deleting a space is such a long running task. If there are more delete tasks than workers I suppose some of the tasks are postponed until they are picked up by a free worker thread.
Does Confluence stop currently running space delete tasks when read-only mode is entered? Does it cancel scheduled tasks not yet started? Or can these tasks somehow prevent read-only mode?

Cheers,
Jens

Hi @jens,

Does Confluence stop currently running space delete tasks when read-only mode is entered?

Confluence does not stop any running tasks. It does not cancel any on-going transactions as well.

Does it cancel scheduled tasks not yet started? Or can these tasks somehow prevent read-only mode?

Confluence does not cancel any scheduled tasks when read-only mode is enabled. How and when the scheduled tasks should be run in read-only mode is at your discretion, i.e. when the task starts to run, it should check if read-only mode is enabled and make the decision.

1 Like

Preparing for Confluence 6.10 says:

The read-only mode feature has been developed specifically for Confluence Data Center.

I’m not sure if this implies that this feature is also only relevant for apps that support data center.

I have seen that there are two issues dedicated to read-only mode (CONFCLOUD-6390 and CONFSERVER-6390). But I cannot determine which issues are to be resolved in 6.10 (although CONFSERVER-55071 suggests that the issue for server is still in discussion).

With other words: Can apps that are designed to only run on server ignore this feature (at least for version 6.10)?

I suppose this is the case, but I need to be sure … :slight_smile:

People running Confluence Server will not be able to enable read-only mode. They won’t even see the option in the admin console.

If your app isn’t available for Data Center, then you won’t need mark your app as compatible with read-only mode. I’d still recommend testing your app with the 6.10 beta on Server however, as there are other changes in this release that might have an impact.

The beta was released yesterday, you can download it here.

Hi all,

On the beta release notes here https://confluence.atlassian.com/doc/confluence-6-10-0-beta-release-notes-950280287.html (at the bottom) there’s talk about a new sandbox meant to handle performance-heavy tasks such as generating thumbnails. And that the plan is to include other tasks here as well.
Is there/will there be a way for vendors to hook into this sandbox to delegate heavy duty tasks or are we supposed to solve it using our own thread pools etc as is recommended if you for example have event listeners.

As a side note does anyone know if the read only mode is meant to come to jira/JSD as well?

Best regards,
Dennis

As a side note does anyone know if the read only mode is meant to come to jira/JSD as well?

I would assume that the recently released Project Archiving feature is the equivalent in Jira.

Hi @ttranminh,

I did the pom changes as suggested here,
1.

<dependency>
		    <groupId>com.atlassian.confluence.compat</groupId>
		    <artifactId>confluence-compat-lib</artifactId>
		    <version>1.2.1</version>
		</dependency>
  1.          <Import-Package>
            		com.atlassian.confluence.api.service.accessmode;resolution:="optional",
                      *;resolution:=optional
               </Import-Package>
    

I see below on atlas-mvn package , but cant make @ReadOnlyAccessModeBlocked annotation working.
[INFO] Copying confluence-compat-lib-1.2.1.jar to /<project_workspace>/target/classes/META-INF/lib/confluence-compat-lib-1.2.1.jar

What am i missing here?

Ans also, adding the instruction will generate .obr for addons right? So doe that mean, an addon which was jar earlier will now be an .obr??

Thank you!

Hi @rrobins,

We ran into a problem with the read-only mode in some of our add-ons. In the permission model of our add-ons, users are allowed certain actions based on whether they have permission to create pages in a certain space, or whether they are allowed to edit a certain page. Some of these actions are only about viewing information, so they should be possible in read-only mode.

Unfortunately, the PermissionManager is now changed to return false for all Create, Edit, SetPermissions and Remove permissions when read-only mode is enabled.

We need a way to figure out whether a user has create/edit permission somewhere regardless of whether read-only mode is currently enabled. Similar to the existing hasPermissionNoExemptions(), it would be nice to have two additional methods that replicate hasPermission() and hasCreatePermission() without making the call to permissionAllowedInReadOnlyAccessMode().

Do you think it would be possible to add such methods in Confluence 6.10?