Question

I am using elFinder 2 + Codeigniter. And I would like to restrict users from deleting or modifying the existing files on all my folders.

I tried with this:

function elfinder_init(){
      $this->load->helper('path');
      $opts = array(
        // 'debug' => true, 
        'roots' => array(
          array( 
            'driver' => 'LocalFileSystem', 
            'path'   => set_realpath('root'), 
            'URL'    => base_url('root'),
             //This didn't do the trick***
            'defaults'   => array('read' => true, 'write' => false, 'locked' => true),
          ) 
        )
      );
      $this->load->library('elfinder_lib', $opts);
    }

It prevent users from uploading new files, but still allows them to modify/delete the existing ones.

Official documentation there is very vague in general and there is no info on how to achieve this, so if you could help me, I'll really appreciate it.

Was it helpful?

Solution

Extracted from their own GitHub issues tickets :

Here is an example to lock folder and subfolder write / delete

 array(
   'pattern' => '/.(lockedFolder1|lockedFolder2)/', 
   // Dont write or delete to this and all subfolders
   'read'  => true,
   'write' => false,
   'locked' => true
 )  

Here is an example to lock root but not subfolders :

 array(
   'pattern' => '/.(lockedFolder1|lockedFolder2)$/', 
   // Dont write or delete to this but subfolders and files
   'read'  => true,
   'write' => false,
   'locked' => true
 )  

Source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top