* Filemanager: fixed super-user not able to create top-level directory, eg. /test

This commit is contained in:
Ralf Becker 2014-10-13 17:23:33 +00:00
parent 7369a71d49
commit dd8f1090f5
2 changed files with 13 additions and 8 deletions

View File

@ -625,7 +625,7 @@ class filemanager_ui
case 'saveaszip': case 'saveaszip':
egw_vfs::download_zip($selected); egw_vfs::download_zip($selected);
common::egw_exit(); common::egw_exit();
default: default:
list($action, $settings) = explode('_', $action, 2); list($action, $settings) = explode('_', $action, 2);
switch($action) switch($action)
@ -1130,7 +1130,7 @@ class filemanager_ui
unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again
foreach($content['eacl'] as &$eacl) foreach($content['eacl'] as &$eacl)
{ {
$eacl['path'] = rtrim(parse_url($eacl['path'],PHP_URL_PATH),'/'); $eacl['path'] = rtrim(parse_url($eacl['path'],PHP_URL_PATH),'/');
$readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] || $readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] ||
$eacl['path'] != $content['path'] || !$content['is_owner']; $eacl['path'] != $content['path'] || !$content['is_owner'];
} }
@ -1247,6 +1247,11 @@ class filemanager_ui
*/ */
public static function ajax_action($action, $selected, $dir=null, $props=null) public static function ajax_action($action, $selected, $dir=null, $props=null)
{ {
// do we have root rights, need to run here too, as method is static and therefore does NOT run __construct
if (egw_session::appsession('is_root','filemanager'))
{
egw_vfs::$is_root = true;
}
$response = egw_json_response::get(); $response = egw_json_response::get();
$arr = array( $arr = array(

View File

@ -406,7 +406,7 @@ app.classes.filemanager = AppJS.extend(
{ {
var path = this.get_path(); var path = this.get_path();
this._do_action('createdir', dir, true); // true=synchronous request this._do_action('createdir', dir, true); // true=synchronous request
this.change_dir(path+'/'+dir); this.change_dir((path == '/' ? '' : path)+'/'+dir);
} }
}, },
@ -462,7 +462,7 @@ app.classes.filemanager = AppJS.extend(
var data = egw.dataGetUIDdata(_senders[i].id); var data = egw.dataGetUIDdata(_senders[i].id);
var url = data ? data.data.download_url : '/webdav.php'+this.id2path(_senders[i].id); var url = data ? data.data.download_url : '/webdav.php'+this.id2path(_senders[i].id);
if (url[0] == '/') url = egw.link(url); if (url[0] == '/') url = egw.link(url);
var a = document.createElement('a'); var a = document.createElement('a');
if(typeof a.download == "undefined") if(typeof a.download == "undefined")
{ {
@ -494,7 +494,7 @@ app.classes.filemanager = AppJS.extend(
is_multiple_allowed: function(action, selected) is_multiple_allowed: function(action, selected)
{ {
var allowed = typeof document.createElement('a').download != "undefined"; var allowed = typeof document.createElement('a').download != "undefined";
if(typeof action == "undefined") return allowed; if(typeof action == "undefined") return allowed;
return (allowed || selected.length <= 1) && action.not_disableClass.apply(action, arguments); return (allowed || selected.length <= 1) && action.not_disableClass.apply(action, arguments);
@ -780,10 +780,10 @@ app.classes.filemanager = AppJS.extend(
event.stopPropagation(); event.stopPropagation();
return false; return false;
}, },
/** /**
* Set Sudo button's label and change its onclick handler according to its action * Set Sudo button's label and change its onclick handler according to its action
* *
* @param {widget object} _widget sudo buttononly * @param {widget object} _widget sudo buttononly
* @param {string} _action string of action type {login|logout} * @param {string} _action string of action type {login|logout}
*/ */
@ -798,7 +798,7 @@ app.classes.filemanager = AppJS.extend(
widget.set_label('Logout'); widget.set_label('Logout');
this.et2._inst.submit(widget); this.et2._inst.submit(widget);
break; break;
default: default:
widget.set_label('Superuser'); widget.set_label('Superuser');
widget.onclick = function(){ widget.onclick = function(){