Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[From China] elFinder 2.0 How to add an extra root #98

Closed
imdong opened this issue Aug 20, 2011 · 14 comments
Closed

[From China] elFinder 2.0 How to add an extra root #98

imdong opened this issue Aug 20, 2011 · 14 comments
Milestone

Comments

@imdong
Copy link

imdong commented Aug 20, 2011

Thank you elFinder, it is useful, I like it.
However, I have a question, like to seek your help.
How can the same as your demo site, it adds a second root directory.
http://elfinder.org/
I hope there is a private, public display.
The other is free to upload.
Appreciate your help.

If you can, I hope that the answer can be more detailed.

汉语:
很感谢您的elFinder,它很好用,我很喜欢它。
但是,我有一个疑问,像寻求您的帮助。
如何才能像您的演示站点一样,为它添加第二个根目录。
我希望有一个是私用,公开展示的。
另一个是自由上传的。
很感谢您的帮助。
如果可以,我希望答案可以详细一些。

Thanks Google Translate

@Gamerz
Copy link

Gamerz commented Aug 22, 2011

Simple. Just "mount" another set of driver and name it "LocalFileSystem" on your opts inside connector.php

Example:

<?php

$opts = array(
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => 'path/to/files/root',         // path to files (REQUIRED)
            'URL'           => 'http://www.localhost.com/files/root/', // URL to files (REQUIRED)
            'alias'  => 'Root',
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        ),
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            'path'          => 'path/to/files/second_root',         // path to files (REQUIRED)
            'URL'           => 'http://www.localhost.com/files/second_root/', // URL to files (REQUIRED)
            'alias'  => 'Secondary Root',
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        )
    )
);

@imdong
Copy link
Author

imdong commented Aug 22, 2011

Very grateful "Gamerz" Help, I've added a second root directory.
However, how the two directories should be assigned separate read and write access it?

Thanks Google Translate

@Gamerz
Copy link

Gamerz commented Aug 22, 2011

Just assign an attributes array inside the specific mounted driver you would like to set the permissions for.

For example, you would like to lock out the "TEST" Folder inside the "Main Root" root, you would do this:

<?php
array(
    'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
    'path' => 'path/to/files/main_root', // path to files (REQUIRED)
    'accessControl' => 'access',             // disable and hide dot starting files (OPTIONAL)
    'attributes' => array(
        array(
            'pattern' => '/\TEST$/', //You can also set permissions for file types by adding, for example, <b>.jpg</b> inside pattern.
            'read' => false,
            'write' => false,
            'locked' => true
        )
    )
),

You can set the following true/false to the attributes:

'read'   => true/false,
'write'  => true/false,
'locked' => true/false,
'hidden' => true/false

Hope this helped!

@troex
Copy link
Member

troex commented Aug 23, 2011

@Gamerz
Copy link

Gamerz commented Aug 24, 2011

Haha, thanks Troex for adding the code view. I was actually trying to find the code format, but never actually got it.

EDIT: The two wikis has now been fully completed.

@imdong
Copy link
Author

imdong commented Aug 24, 2011

However, if only to set permissions on a directory.
Hidden .tmd folder. Can not hide Htaccess files?

@Gamerz
Copy link

Gamerz commented Aug 24, 2011

I'm not understanding? What are you trying to do?

@imdong
Copy link
Author

imdong commented Aug 24, 2011

No, now very satisfied.
I was doing.

'accessControl' => 'upfile' // disable and hide dot starting files (OPTIONAL)

Thank you for your help.

Also, put a proposal:
There should be anonymous and management differences.

I was doing.

function access($attr, $path, $data, $volume) {
session_start();
if ($_SESSION['elFinder_login']=="Yes")
$Write = "write";
else
$Write = "locked";

return strpos(basename($path), '.') === 0   // if file/folder begins with '.' (dot)
    ? !($attr == 'read' || $attr == $Write)  // set read+write to false, other (locked+hidden) set to true
    : ($attr == 'read' || $attr == $Write);  // else set read+write to true, locked+hidden to false

}

@troex
Copy link
Member

troex commented Aug 24, 2011

imdong,

"anonymous" or "user" is that what you need to do yourself, what you have done is a right way also.

@troex
Copy link
Member

troex commented Aug 24, 2011

I assume this issue as fixed

@troex troex closed this as completed Aug 24, 2011
@imdong
Copy link
Author

imdong commented Aug 24, 2011

Anyone can upload files, including the shell.
It was horrible.
Prohibit the uploading, I was not convenient to manage files.
Should have "visitors" and "administrator" difference.
To be a landing.

I made ​​a simple login authentication.

@philouphil
Copy link

Better to use in elFinderVolumeDriver.class.php

@uFlock
Copy link

uFlock commented Feb 8, 2016

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' => '/^*/', //You can also set permissions for file types by adding, for example, .jpg inside pattern.
                                    'read'    => true,
                                    'write'   => false,
                                    'locked'  => false,
                                    'hidden'  => false
                                )
                            )

But it has no effect whatsoever - i can still delete and rename first level folders. Am i missing the point completely as always?

Thank you for your time.

@paulcanning
Copy link

@uFlock try '/^.+/' for your pattern

EDIT - hmm this seems to effect all files. Not sure how to target folders, unless you target their specific name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants