PHPackages                             onedrop/restrictedfiles - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. onedrop/restrictedfiles

ActiveNeos-package[Utility &amp; Helpers](/categories/utility)

onedrop/restrictedfiles
=======================

1.2.0(8y ago)21.0kPHP

Since May 15Pushed 8y ago2 watchersCompare

[ Source](https://github.com/1drop/Onedrop.RestrictedFiles)[ Packagist](https://packagist.org/packages/onedrop/restrictedfiles)[ RSS](/packages/onedrop-restrictedfiles/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (9)Used By (0)

Onedrop.RestrictedFiles
=======================

[](#onedroprestrictedfiles)

What it does
------------

[](#what-it-does)

This package allows your Neos editors to make resources protected via the Neos MediaBrowser.

You can define a list of collection titles that should be protected and this package will handle the resource manipulation internally to ensure that the files are then protected.

This package depends on `wwwision/privateresources` and you can check the configuration of that package on how to configure the protected resources themselves.

Configuration
-------------

[](#configuration)

You should create an AssetCollection in the Neos backend and configure the title of that collection to be protected:

```
Onedrop:
  RestrictedFiles:
    collectionNames: ['Protected']
```

Restrict download to permission
-------------------------------

[](#restrict-download-to-permission)

This package also provides a simple way to restrict the download of a file to a `privilegeTarget` that can be assigned to any role.

To grant access to the files just add this privilegeTarget to a role:

```
roles:
  'Some.Package:SomeUser':
    privileges:
      -
        privilegeTarget: 'Onedrop.RestrictedFiles:Download'
        permission: GRANT
```

You can disable this feature by setting:

```
roles:
  'Neos.Flow:Everybody':
    privileges:
      -
        privilegeTarget: 'Onedrop.RestrictedFiles:Download'
        permission: GRANT
```

Handling unauthorized download attempts
---------------------------------------

[](#handling-unauthorized-download-attempts)

This package will emit a `\Neos\Flow\Security\Exception\AccessDeniedException` if an unauthorized access to a download occurs. There is a signal you can subscribe on to change that behavior to e.g. redirect to a page.

Example:

```
