This module integrate Collabora Online to Drupal. You can use it to view and edit documents from within Drupal.
Requirements:
- Collabora Online server installed and running.
- Drupal 10 (tested on 10.1), maybe compatible with 9.
- JWT and Media are set as dependencies for the module and are necessary.
See the Drupal guide to install modules.
To install on a project, user PHP composer:
composer require drupal/collabora_online
If you get an error saying but it does not match your minimum-stability
, you may need to adjust the minimum-stability
field in the composer.json
of your project.
Then you can go into Drupal logged as an admin and go to Extend. In the list you should be able to find Collabora Online and enable it.
From there you can access the module specific configuration.
If you intend to develop or contribute to the module, you can install directly from git.
In your Drupal setup, in the directory modules/contrib
extract the
module into a directory collabora_online
.
You can get it directly with git:
git clone https://github.com/CollaboraOnline/collabora-drupal.git collabora_online
There are few step necessary in Drupal to configure the integration.
Log into Drupal as an admin.
Go to Configuration > System > Keys
- Create a JWT HMAC key, with the HS256 algorithm.
- Set it to be provided by the configuration.
You can create a secret using the following shell command:
head -c 64 /dev/urandom | base64 -w 0
Go to Configuration > Media > Collabora Online Settings
- Collabora Online server URL: the URL of the collabora online
server. Note that you have to take into considerartion containers. If
you run Drupal in one container and Collabora Online in another, you
can not use
localhost
. - WOPI host base URL: how the Collabora Online server can reach the Drupal server. Usually it is the public URL of this Drupal server.
- JWT Private Key ID: the id of the key created above.
Optional
- Disable TLS certificate check for COOL: If you configure a development server you might have self-signed certificate. Checking this is INSECURE but allow the drupal server to contact the collabora online server is the certificate doesn't check.
- Access Token Expiration: In second the expiration of the token to access the document. Default to 86400 seconds (24 hours).
Some configuration changes might be necessary on the Collabora Online side.
CSP for embedding must set properly to embed the Collabora Online frame.
To be able to attach document to Drupal content nodes, you need to create a field.
Login as an admin, and got to the admnistration section.
- Go to Structure > Content types
- Find the appropriate content and click Manage fields.
- Click + Create a new field (or if you already have created one you can re-use one)
- Enter a label, select Media, click Continue
- At the bottom for Media type, select Document. Click Save Settings. Type of item to reference should have been set to the default value of Media.
You also must set the viewer for this kind of media.
- Go to Structure > Media Types
- Select Manage Display for Document
- In the Field section, select in the Format column, choose Collabora Online Preview.
- Click Save.
There are three levels of permissions. Administrator, Collaborator, and Viewer, in order of most privileges to the least. Each lesser privilege is included in the higher level. Administrator includes Collaborator, and Collaborator includes Viewer.
By default, the user role administrator
is mapped to the Collabora
Online administrator. This allow accessing the console.
The user role authenticated
is the default permission for
collaboration, i.e. edit a document with Collabora Online.
The user role anonymous
by default disallows editing and is the
minimal permission for viewing documents in Collabora Online.
If you need to change the accepted extensions to upload, go to Administration > Structure > Media Type, for the line Documents, click Edit, then click Manage Fields, and for the right field, Edit:
- You can change the allowed file extensions.
To increase the maximum upload size (it is indicated on that page), you need to increase the value in the PHP configuration.
Usually you can add a file max_file_size.ini
(the name isn't much
important except its extension should be .ini
) into
/etc/php/conf.d/
(the path may be different) and put the following:
post_max_size = 30M
upload_max_filesize = 30M
These set the limits to a maximum of 30M. You can change as appropriate.
This module is published under the MPL-2.0 license.