Nova-Filemanager icon indicating copy to clipboard operation
Nova-Filemanager copied to clipboard

Ability to set disk at runtime

Open toonevdb opened this issue 6 years ago • 2 comments

What I am trying to achieve, is to set a different disk depending on the user role like so:

if (Auth::user() &&  Auth::user()->hasRole('superadmin')) {
    config(['filemanager.disk' => 'public']);
}

I tried placing that codeblock first in a Middleware and then in NovaServiceProdiver@tools method at the top. But the tool only picks up what I have set in config/filemanager.php.

Is it possible to have it pick up config changes at runtime? I'm a bit unsure of Nova Tools lifecycle. I don't understand why the 'config set' call is not picked up. If I log to a debug file, I notice the 'config set call' happens before constructing Nova-Filemanager/Http/Services/FilemanagerService. Maybe I'm missing something. Would be nice if there was a way to somehow set the disk at runtime but unsure if it's possible.

toonevdb avatar Feb 11 '20 12:02 toonevdb

Yes, would be nice to lockdown the registered user in dynamic folder based on user's (unique) name or Id, so only registered user can see the files & folders owned.

mokchend avatar Apr 22 '20 15:04 mokchend

Yes, would be nice to lockdown the registered user in dynamic folder based on user's (unique) name or Id, so only registered user can see the files & folders owned.

did you figure out how to do it?

takifouhal avatar May 30 '21 00:05 takifouhal