prevent mkdir in Elfinder

早过忘川 提交于 2019-12-11 07:09:49

问题


Im trying to disable the mkdir-option in elfinder. I just want uploads in my (root)-folder allowed. The following solution does not disable the mkdir option (even I removed the mkdir). Any hints?

tinyMCE.activeEditor.windowManager.open({
file : 'elfinder/elfinder.html',
        title : 'elFinder 2.0',
        width : 950,  
        height : 630,
        resizable : "yes",

    uiOptions: {
        toolbar : [
            // toolbar configuration
            ['open'],
            ['back', 'forward'],
            ['reload'],
            ['home', 'up'],
            ['mkfile', 'upload'],
            ['info'],
            ['quicklook'],
            ['copy', 'cut', 'paste'],
            ['rm'],
            ['duplicate', 'rename', 'edit'],
            ['extract', 'archive'],
            ['search'],
            ['view'],
            ['help']
        ]
    },

   commands : [
    'open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
    'download', 'rm', 'duplicate', 'rename', 'mkfile', 'upload', 'copy',
    'cut', 'paste', 'edit', 'extract', 'archive', 'search', 'info', 'view', 'help'
   ],                       
}

回答1:


Edit the connector.php file and add a key named 'disabled'

    'roots' => array(
            array(
                    'driver'     => 'LocalFileSystem',
                    'path'       => '../../ava/externo/',
                    'startPath'  => '../../ava/externo/',
                    'URL'        => dirname($_SERVER['PHP_SELF']) . '/../../ava/externo',
                    'tmbPath'    => '.tmb',
                    'utf8fix'    => true,
                    'tmbCrop'    => false,
                    'tmbBgColor' => 'transparent',
                    'accessControl' => 'access',
                    'acceptedName'    => '/^[^\.].*$/',
                    'disabled' => array('extract', 'archive', 'mkdir'),
                    'tmbSize' => 128,
                    'attributes' => array(
                            array(
                                    'pattern' => '/^\/icons$/',
                                    'read' => true,
                                    'write' => false
                            ),
                            array(
                                    'pattern' => '/\.php$/',
                                    'hidden' => true,
                                    'read' => false
                            ),
                            array(
                                    'pattern' => '/\.zip$/',
                                    'read' => true,
                                    'write' => true
                            )
                    ),
                    'uploadDeny' => array('text/php')



回答2:


Note that at this time, using disabled does not disable the command when executed via shortcut (hotkey). For example, when you disable upload, Ctrl-u will still allow users to upload files.

You can disable all hotkeys with allowShortcuts: false in your initial config. You can also disable shortcuts for specific commands there with something like this:

commandsOptions: {
   upload : {shortcuts : []},
   rm : {shortcuts : []},
   download : {shortcuts : []}
},

Unfortunately, I haven't found a way do this in the connector.


来源:https://stackoverflow.com/questions/22432359/prevent-mkdir-in-elfinder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!