-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Please disconnect delete and rename #1545
Comments
What about elFinder complies with the file attributes of a typical file system. |
I tried Files were only re-nameable when NB setting |
Here is a screenshot showing a file that has the following attributes:
As you can see, the rename icon is clickable (not muted/greyed out) |
Renamable operate on files of the write-protected is a specification of the common file system, such as Linux. |
I am running this on a Linux server, connected to Google Cloud Storage. I have provided evidence that They need to be separated. |
The operation of elFinder by the file attribute is by design. If you need to change the specifications, please customize the elFinder. |
If that is the case, can you provide information on how to enable/disable certain toolbar icons based on specific file attributes? Example, if I give a file an extra attribute of |
for easy customization of the ui-command for each volume. rel. #1545, #1549. **Example to disable `rm` of not writable items in selected volume** - Front end - JavaScript ```javascript // command `rm2` extends `rm` (elFinder.prototype.commands.rm2 = function() { this.getstate = function(sel) { var fm = this.fm; sel = sel || fm.selected(); return !this._disabled && sel.length && // check `write` too $.map(sel, function(h) { var f = fm.file(h); return f && f.phash && !f.locked && f.write ? h : null }).length == sel.length ? 0 : -1; }; }).prototype = { extendsCmd : 'rm', // extends command name forceLoad : true // to force load }; var options = { url : 'php/connector.php', } $('#elfinder').elfinder(options); ``` - Back end - PHP connector ```php // customized volume driver class elFinderMyVolumeLocalFileSystem extends elFinderVolumeLocalFileSystem extends { protected function remove($path, $force = false) { if (! $force && ($stat = $this->stat($path)) && ! $stat['write']) { return $this->setError(elFinder::ERROR_PERM_DENIED, $this->path($stat['hash'])); } return parent::remove($path, $force); } } $opts = array( 'roots' => array( array( 'driver' => 'LocalFileSystem', 'path' => '/path/to/files/', 'URL' => 'http://localhost/to/files/', ), array( 'driver' => 'MyLocalFileSystem', 'path' => '/path/to/files2/', 'URL' => 'http://localhost/to/files2/', 'uiCmdMap' => 'array('rm' => 'rm2'), // use `rm2` instead `rm` ), ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); ```
Example to disable
// command `rm2` extends `rm`
(elFinder.prototype.commands.rm2 = function() {
this.getstate = function(sel) {
var fm = this.fm;
sel = sel || fm.selected();
return !this._disabled && sel.length &&
// check `write` too
$.map(sel, function(h) { var f = fm.file(h);
return f && f.phash && !f.locked && f.write ? h : null }).length ==
sel.length
? 0 : -1;
};
}).prototype = {
extendsCmd : 'rm', // extends command name
forceLoad : true // to force load
};
var options = {
url : 'php/connector.php',
}
$('#elfinder').elfinder(options);
// customized volume driver
class elFinderMyVolumeLocalFileSystem extends
elFinderVolumeLocalFileSystem extends
{
protected function remove($path, $force = false) {
if (! $force && ($stat = $this->stat($path)) && !
$stat['write']) {
return $this->setError(elFinder::ERROR_PERM_DENIED,
$this->path($stat['hash']));
}
return parent::remove($path, $force);
}
}
$opts = array(
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => '/path/to/files/',
'URL' => 'http://localhost/to/files/',
),
array(
'driver' => 'MyLocalFileSystem',
'path' => '/path/to/files2/',
'URL' => 'http://localhost/to/files2/',
'uiCmdMap' => 'array('rm' => 'rm2'), // use `rm2` instead `rm`
),
)
);
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run(); |
So it seems that the only way to allow renaming of a file is to have it unlocked (
locked = 0
)But doing so also lets the user delete the file.
I want to let users rename, but not delete.
Can you either add in a flag for delete protection, or disconnect rename and delete so I can do one but not the other?
The text was updated successfully, but these errors were encountered: