FileManagerBundle
FileManagerBundle copied to clipboard
Prevent deletion of predefined folders
Hello,
Thank you for this amazing library. Would it be possible to prevent users from deleting some "main" folders? For example,
uploads
--> folder 1
--> folder 2
--> folder 2
From reading the documentation this would be possible using custom service; if this is correct, could you provide a small example?
Essentially ACLs are needed... who can upload, who cannot... when you have a basic user system with Symfony.
We managed to do ACLs using the following method:
- Inject user roles via CustomService (however your documentation is a bit wrong, it should be using TokenStorageInterface)
- Subscribe to events and check user roles
However, there are still some things lacking:
- You need to put a try/catch here https://github.com/artgris/FileManagerBundle/blob/683f1a349db2b28afdd88bdabe115e5e71e096ca/Controller/ManagerController.php#L238 because otherwise the custom message is now shown. We also recommend renaming this even to PRE_FILE_UPLOAD for consistency.
- There is no event for creating folders; just plain POST so this cannot be restricted.
- Folders are not listed, only on the left navigation menu.
Thank you