CollaboraOnline / collabora-drupal

Collabora Online Drupal module
Mozilla Public License 2.0
1 stars 1 forks source link

Collabora Online connector for Drupal

This module integrate Collabora Online to Drupal. You can use it to view and edit documents from within Drupal.

Installation

This section describes how to install the module in an existing Drupal website project. For a local demo or test installation, see below.

Requirements

Installation steps

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.

Please check the "Configuration" section below!

Development / demo installation

A local demo and testing instance can be installed using docker-compose.

Requirements

Installation steps

First, git clone the repository into a new directory, outside of any other Drupal project.

git clone https://github.com/CollaboraOnline/collabora-drupal.git collabora_online

Then run the following steps.

docker-compose up -d

docker-compose exec web composer install
docker-compose exec web ./vendor/bin/run drupal:site-install

Optionally, generate an admin login link.

docker-compose exec web ./vendor/bin/drush uli

The last command will output a link to the local website, with login for the admin account.

Otherwise, the local website will be available at http://web.test:8080/. The administrator login is 'admin'/'admin'.

Configuration.

The demo instance is already fully configured.

See "Configuration" for optional customization.

Using the demo instance

Minimal steps to see the editor in action:

Advanced usage:

Running the tests

To run the phpunit tests:

docker-compose exec web ./vendor/bin/phpunit

Configuration

The configuration steps below are necessary to use the module in an existing Drupal website. In the local development/demo installation, the manual configuration is optional.

Log into Drupal as an admin.

JWT key

Go to Configuration > System > Keys

You can create a secret using the following shell command:

head -c 64 /dev/urandom | base64 -w 0

Collabora Online

Go to Configuration > Media > Collabora Online Settings

Optional

COOL

Some configuration changes might be necessary on the Collabora Online side.

CSP for embedding must set properly to embed the Collabora Online frame.

Fields

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.

You also must set the viewer for this kind of media.

User permissions

The module introduces permissions, which can be managed at /admin/people/permissions.

The 'Administer the Collabora instance' permission grants administrator access within the Collabora Online instance, when Collabora is used within Drupal. Most of the time this permission is not needed, if the Collabora instance is configured from outside of Drupal.

For each media type, the module introduces two permissions:

In the current version, preview and edit access with the Collabora Online editor are checked independently of the publishing status of the respective media, and independently of the regular view or edit access on that media entity.

For a consistent experience, it is recommended that a role with the edit permission should also be granted the preview permission, and that a user with any of the Collabora media permissions should also be granted permissions to view the respective media entity in Drupal.

Developers can use entity access hooks to alter which users may edit or preview media files in Collabora. This would allow to grant access based on e.g. membership in a group.

Other configuration

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:

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.

License

This module is published under the MPL-2.0 license.