Drupal is a registered trademark of Dries Buytaert

nextcloud_dam

No security coverage
View on drupal.org

This module integrates Nextcloud in Drupal in a way that it could be used as a source of media.
Some background information can be found in this blog entry.

Features

It will work as DAM in drupal, as bynder, acquia dam, or other modules do. So a separate workgroup could work in Nextcloud, and the publisher could use the assets done in drupal side. It's based on Media, Social auth and entity browser.

It needs the Webapppassword app in nextcloud side. I hope that soon things will work just with nextcloud core apps, using minimal nextcloud. But is not accepted yet in Nextcloud side.

The nextcloud credentials are not out of control in drupal, as it uses a dedicated vue filepicker frontend to operate with nextcloud content. As Oauth2 auth token expires everyday and one can revoke key from nextcloud I think it's fairly safe to use. One could use this credential to update metadata, then this will be used from server where drupal is placed. But once again is controlled by a token delivered from user that has a short expiration time.

More information on how it works available in README.md

Post-Installation

This module comes with a single predefined media type named nextcloud and an entity browser named nextcloud filepicker to pickup the files. One can replicate the media type found in /admin/structure/media in order to create another media type, for example if is wanted to have separated mime types coming from nextcloud, namely: "nextcloud video", "nextcloud image" and "nextcloud document".

One thing that this module doesn't do automatically is attach to a node content, so it's a required step.
An entity reference type field must be added for example in article must be done in /admin/structure/types/manage/article/fields referencing a nextcloud media type in /admin/structure/types/manage/article/fields/node.article.field_nc_media, and then choose in /admin/structure/types/manage/article/form-display entity browser widget with this widget configuration:

      entity_browser: nextcloud_filepicker
      field_widget_display: rendered_entity
      field_widget_edit: true
      field_widget_remove: true
      field_widget_replace: false
      open: false
      field_widget_display_settings:
        view_mode: default
      selection_mode: selection_append

The entity browser also comes in a simple way so in /admin/config/content/entity_browser/nextcloud_filepicker/widgets it is referencing just the nextcloud media type created automatically, but if other media types are created as explained preveiously, they can be mapped in /admin/config/content/entity_browser/nextcloud_filepicker/widgets, the relationship there is always linked by now so this setting is by now not used, as drupal and browser cache will be used to perform the "copy" from nextcloud origin.

Multiple nextcloud support

Multiple nextcloud instances could be used, this is done using nextcloud social auth module ( https://www.drupal.org/project/social_auth_nextcloud ), so user can obtain files from many nextclouds. Refer to social auth module for more information.
One thing that may be missed is the permanent token, nextcloud supports it using app passwords. But by now this is not implemented in social_auth, keep in touch with social_auth_nextcloud development to be informed when this feature is implemented. Non permanent Oauth2 token is used by now, this means that token will expire often and user will need to reauth the token going to nextcloud again. This is done in this manner as is the more secure way to associate each site in a way that server owner or site admin has limited power over your data and credentials, look at this post to understand a little more: https://www.oauth.com/oauth2-servers/access-tokens/access-token-lifetime/ .

In the content form, the entity browser will render as many nextcloud browser as credentials defined in user's social auth user settings.

The operations and communications with the nextcloud api are done in browser client side using vue.js filepicker (based in great work of : https://github.com/julien-nc/nextcloud-webdav-filepicker ). So no server side operations are done. Just the refetch operation is done in server-side. do not use it and remove permission allow refresh metadata for unwanted roles if server communication should be avoided.

Refreshing metadata

Sometimes the file metadata is edited in nextcloud so drupal must refetch metadata. This could be done in each node going to nextcloud media usage tab in each node ( /node/{nid}/nextcloud-usage ).

Development information

Some development notes of how this module was made can be found in README.md and DEVELOPMENT.md.

Plans without estimated date

Extend nextcloud social auth to allow a permanent app password for communities that trust both endpoints (drupal and nextcloud sites).
Group contents interoperability, syncing nextcloud groups content and drupal groups content together with their access permissions.
Other content widgets and fields, such as document editors in drupal side.
Search frontend using nextcloud search api.

Uninstall

To be uninstalled you must remove nextcloud media entities, remove the media type, and the field storage config must be deleted, as not everybody could run drush config:del field.storage.media.nextcloud_metadata, you can find a removal confirmation in status report section Nextcloud DAM or directly in module uninstall help text.

Additional Requirements

Nextcloud with properyi configured webapppassword app.

TODO

Similar projects

https://www.drupal.org/project/acquia_dam

https://www.drupal.org/project/bynder

Supporting this Module

Patreon, OpenCollective, etc. To be planned describe how people can support development.

Community Documentation

TODO

Activity

Total releases
1
First release
Dec 2024
Latest release
1 year ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha2 Pre-release Dec 9, 2024