artgris / FileManagerBundle

FileManager is a simple Multilingual File Manager Bundle for Symfony
MIT License
171 stars 89 forks source link

Add permissions system using Symfony roles #87

Closed Naroh091 closed 3 years ago

Naroh091 commented 3 years ago

This pull request adds the ability to enable and restrict actions based on the role the user has.

The actions under this permission system are upload/rename/remove files and create/remove folders.

By default, all these actions are available for users with ROLE_USER. To change this, just add some lines to the artgris_file_manager.yaml under the conf you want to customize:

artgris_file_manager:
  conf:
    default:
      dir: "../public/uploads"
      permissions:
        upload_files: ROLE_ADMIN
        remove_files: ROLE_SUPER_ADMIN
        rename_files: ROLE_ADMIN
        create_folders: ROLE_ADMIN
        remove_folders: ROLE_SUPER_ADMIN

If the user doesn't have the required role to perform the action the corresponding buttons will be hidden.

Naroh091 commented 3 years ago

Wops, looks like I selected other commits that shouldn't be here. Closing to fix it...