문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top