barryvdh / laravel-elfinder

elFinder bundle for Laravel
745 stars 171 forks source link

How to make a folder read-only to certain user type? #177

Closed divan-mt closed 7 years ago

divan-mt commented 7 years ago

I would like to give full disk access to the admin and readonly access to the users. How can I achieve this configuration?

ercanertan commented 7 years ago

In my case I have done following. But for your case just let admin able to change from backend and done. in your AppServiceProvider

   try {
        if (Schema::hasTable('settings')) {
            $settings = Setting::pluck('value', 'key')->toArray();
            if (isset($settings['media_lock'])) {
                if ($settings['media_lock'] == 'false') {
                    \Config::set(["elfinder.root_options.attributes.0.locked" => false]);
                }else{
                    \Config::set(["elfinder.root_options.attributes.0.locked" => true]);
                }
            }
        }
    } catch (\Illuminate\Database\QueryException $e) {
        app('log')->error($e->getMessage());
    }