Search code examples
phpjqueryregexelfinder

elFinder - Separate Access Control For Root Folder and Subfolders


I have a really thick question, but how do I disable Deleting/Renaming the first level of folders in root?

For Example if my root path is path/to/files then I want to prevent the user from being able to delete/rename the first level of folders after the root path/to/files/first_level_folder, but the user should be able to have full control inside the path/to/files/first_level_folder/Subfolders.

I tried doing:

    'attributes' => array(
                        array(
                                'pattern' => '/no_edit_path/', 
                                'read'    => true,
                                'write'   => false,
                                'locked'  => true,
                                'hidden'  => false
                            ),
                        array(
                                'pattern' => '/no_edit_path/*', 
                                'read'    => true,
                                'write'   => true,
                                'locked'  => false,
                                'hidden'  => false
                            ),
                        )

I have the desired effect in that the user can't temper with the first level folders, but then I can't add sub-folders and files... Is there a workaround?

Thank you for your time.


Solution

  • After trying few more things I found a solution. Maybe it will help someone in the future.

      'attributes' => array(
                            array(
                                    'pattern' => '/no_edit_path$/', 
                                    'read'    => true,
                                    'write'   => false,
                                    'locked'  => true,
                                    'hidden'  => false
                                ),
                            array(
                                    'pattern' => '/no_edit_path/.*/', 
                                    'read'    => true,
                                    'write'   => true,
                                    'locked'  => false,
                                    'hidden'  => false
                                ),
                            )