Manage your documents on your DMS from Drupal using CMIS API module

  • 03 Sep 2020



The requirement


In a majority of cases, document (and on a bigger picture, media) management is done on Drupal directly. Especially now that there are the Media and Media Library modules in Core, media management in Drupal has received a lot of improvements during the last years.


But sometimes, you need to be able to connect to a DMS (document management system) for one or several of the following reasons:

  • The tool is already in place into your customer’s information system architecture.
  • This allows you to delegate access control management on documents to this external tool. And therefore keep your Drupal website “simple”.
  • DMS, by their specialization/name/designation, have more advanced features than Drupal on documents:
    • Versioning,
    • Metadata,
    • Edition,
    • Etc.


The project driving our contribution on the module was to develop an intranet for storing documents and delivery forms on an Alfresco DMS, using Drupal as a simplified user interface to interact with the documents in the DMS.

What is CMIS?


“CMIS (Content Management Interoperability Services) is an open standard that allows different content management systems to interoperate over the Internet.“


CMIS query example:

CMIS query examples

As you may have guessed, the CMIS API module has been used as it provides the link between Drupal and Alfresco (or any CMIS compliant system).


Module’s history

Drupal 7 and before (hypothesis)


There is an ecosystem of CMIS modules already present on, here is an overview of its:

  • CMIS Alfresco (D6)
    • Deprecated in favor of the CMIS API module.
  • CMIS API (D7)
    • Initially an initiative (maybe partnership?) between Acquia and Alfresco because a lot of people involved indicate working at Alfresco on their profile.
  • CMIS Views (D7)


Now we will focus on CMIS API as it is the one providing a generic implementation and tools for other modules.

Drupal 8


There were 2 Drupal 8 branches on the CMIS API module :

  • 8.x-1.x-dev
    • Port of the Drupal 7 version but non-optimal usage of object oriented code provided by Drupal 8 (no service, object non easy of use (DX), …)
  • 8.x-2.x-dev (our contribution started from this branch)
    • Use a new version of the dkd/php-cmis-client library (Guzzle 6 compatible)
    • Codebase stabilization (Drupal Coding Standard, deprecations removal) 
    • Add new features


We focused on the 8.x-2.x branch and among fixing coding standards, removing deprecated code, fixing some bugs, we added new features. And now we will see the features of the module.


Current features

CMIS connection


The first thing to do with the CMIS module is to configure a connection to the DMS.


CMIS Connection


We added the “CMIS folder ID” setting to get a file browser already opened from this folder (new).

Sub module: CMIS Alfresco Auth User (new)


When the user logs in using Drupal login form, the username and password are also sent to an Alfresco endpoint to authenticate on Alfresco too and retrieve an authentication “ticket”.

Authentification ticket 1

Authentification ticket 2

Authentification ticket 3


This allows you to use different users for the CMIS connection without having to define a CMIS connection for each user.

File browser


The main feature of the module is to provide a file browser allowing users to view, upload or delete folders and documents.

Now the access control if the user can upload or delete a file / create or delete a folder, is no more using a Drupal permission but checking permission in the DMS directly (new).


CMIS Browser

CMIS query page


A page to make CMIS queries directly without UI limitation.


Request CMIS

Field formatters:


There is a CMIS field type that allows you to select a CMIS document or folder. This information can be displayed using two field formatters:

  • Link to the CMIS document
  • File browser starting on the selected folder (new)




Next steps


The module currently provides some nice features that may answer a lot of needs. But the current codebase is difficult to work with, so adding new features is hard, or impossible.


Therefore to ensure the module will be and stay healthy, we may be doing the following steps which are a mix of refactoring and features addition:

  • Rethink codebase’s architecture:
    • Implement services
    • Add a connections factory service
    • Routes: to have proper non-ajax support if needed and better organized routes
  • Rethink how the display is done to ease the theming and overrides
  • Audit the UI strings
    • Translating strings in French highlighted that even in English some UI strings are not correct
  • Refactor authentication part
    • Support Nuxeo, etc.
  • Implement sort and pager on the file browser
    • Depends on the PHP CMIS Client library
  • Media integration
    • Import a CMIS document as a Media entity so it can be used as any “standard” image for example
  • Implement automated tests
    • The setup will be hard to do


Thanks to Ian Norton for granting us access to the CMIS API module.

And thanks to our customer’s project needing improvements on the CMIS API module to have permits us to contribute back.

Now the Drupal 8 version of the CMIS API module is back on track and by releasing the 8.x-2.0-alpha1 version, we hope that this will help raise the Drupal 8 module’s usage and gather momentum.


PS: On Tuesday, September 1st, Florent Torregrosa held a meetup on various topics such as Entity Share V3, CMIS and File Extractor. You can find his article here [FR] and the presentation slides here [EN]