Search code examples
javascriptphpjqueryhtmlelfinder

How to only show a list of the folder in elfinder (a jquery file manager plugin)


I am working on the file manager plugin:

http://studio-42.github.io/elFinder/#elf_l1_Lw

In the root folder , user can share the folder to the others, however, if the folder is not share, others should not see it.

In the tutorial , I can hide the folder base on the folder name pattern

https://github.com/Studio-42/elFinder/wiki/Simple-file-permissions-control

<?php
array(
    'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
    'path'   => 'path/to/files',   // path to files (REQUIRED)
    'attributes' => array(
        array(
            'pattern' => '/^TEST$/', //You can also set permissions for file types by adding, for example, .jpg inside pattern.
            'hidden'    => true
        )
    )
),

However , the problem are:

1) how to restrict the rule to a list of folder instead of pattern? e,g, I will store the file name at the database for the share information, the user will get a list of allow , readable folder

2) how to restrict the rule to folder only (not file) , and only the root folder?

Thanks a lot for helping.


Solution

  • If you want to have shared folder for all your users and at the same time have a user specific folder - I'd recommend that you use Multiple Roots

    Learn to use patterns, you can use one for folder like in your example and one for files in this folder with 'pattern' => '/^TEST\/.*/'