gordon-matt / peachpie-responsive-file-manager

Responsive File Manager running on .NET Core with Peachpie
24 stars 16 forks source link

Disable some functionnalities #27

Closed Antonyab closed 2 years ago

Antonyab commented 2 years ago

Hello again,

Thank you again for your reply.

Is it possible to disable some functionnalities?

I am trying to only allow uploading a new file or folder and to download files only.

Is it possible to do this?

Thank you in advance.

Regards, Antony

gordon-matt commented 2 years ago

This project is just a way of using Responsive File Manager (someone else's PHP project) in .NET Core. I've not delved into all the different options that are available. You can find all the options here:

https://www.responsivefilemanager.com/#documentation-section (Search for the "CONFIG.PHP PARAMETERS SETTING" section)

So far I have only implemented 4 of these:

upload_dir
current_path
thumbs_base_path
MaxSizeUpload

If you find any of the other options very useful, let me know and I will see about implementing them. Alternatively, you can implement whatever you want and create a pull request. The way it works is quite simple:

  1. The ResponsiveFileManagerOptions class (/ResponsiveFileManager.AspNetCore/ResponsiveFileManagerOptions.cs) needs to have the new properties added which correspond to the ones in RFM's config.php file

  2. The whole ResponsiveFileManagerOptions class is passed to PHP via PeachPie as a variable named rfm_options.. You can see how here: /ResponsiveFileManager.AspNetCore/RequestDelegateExtension.cs

  3. The config.php file (/ResponsiveFileManager/filemanager/config/config.php) is modified to use those values. For example:

'upload_dir' => $rfm_options->UploadDirectory,
'current_path' => $rfm_options->CurrentPath,
'thumbs_base_path' => $rfm_options->ThumbsBasePath,
'MaxSizeUpload' => $rfm_options->MaxSizeUpload ?? 10,

I'm closing this issue. Feel free to open a new one for a specific request or a PR if you do the work yourself.