Module Description
Protected file module provide a new field type which extends File field and permit to enable/disable for each file the possibility to prevent users to download the file, if they don't have the right permission, whereas the file is still visible on the page.

This module is useful if you want to prevent users to download file, but you want display the file regardless.

REQUIREMENTS This module provide a new field type "Protected file" based on the File field type. File is provided by Drupal core.

This module requires that the private system file is available.

SIMILAR MODULES Field permissions permit to set permissions on fields, and then can prevent users to access to file uploaded with a File field. But users without the permissions don't see then the file attached to an entity.

Protected file permit to display every files, but can prevent users to download them. This can be useful if you want that users have to register to be able to download some (specific) file(s).

INSTALLATION Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/documentation/install/modules-themes/modules-8 for further information.

CONFIGURATION
* Create a "Protected file" field on an entity
* Configure the field settings as the standard File field (directory, extension, etc.)
* Configure the field formatter : you can specify if the file is downloaded in a new tab, the redirect path for users without permissions, if the redirect path is open inside a modal or not, and the text used for the title link. If the redirect path is empty, and user has not the permission to download the protected file, then only the name of the file, without link, is displayed
* Configure the permissions to allow Roles to download protected file
* Create content and upload some files. For each file you can protect them by checking the protected checkbox

You can override the twig template protected-file-link.html.twig if you want customize the feel and look of your protected files.

By default, the module provide and inject a markup based on a fontawesome class for protected files (fa-lock icon). This markup is available in the {{ icon }} twig variable. You can easily override it in the template or in a preprocess fonction.

This module was sponsored by Cerema.

Project Usage
321
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
Protected file module provides a new field type to prevent users from downloading files without the right permissions, while still displaying the file on the page.
Data Name
protected_file

OPENAI CHATBOT

OPENAI CHATBOT

15:23:03
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.