forked from extern/egroupware
Disable delete action in context menu based on user rights not based on being anonymous
This commit is contained in:
parent
79d3d27388
commit
5d598a042b
@ -248,6 +248,7 @@ class filemanager_ui
|
|||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'confirm' => 'Delete these files or directories?',
|
'confirm' => 'Delete these files or directories?',
|
||||||
'onExecute' => 'javaScript:app.filemanager.action',
|
'onExecute' => 'javaScript:app.filemanager.action',
|
||||||
|
'disableClass' => 'noDelete'
|
||||||
),
|
),
|
||||||
// DRAG and DROP events
|
// DRAG and DROP events
|
||||||
'file_drag' => array(
|
'file_drag' => array(
|
||||||
@ -317,12 +318,6 @@ class filemanager_ui
|
|||||||
$actions['paste']['children']["{$action_id}_paste"] = $action;
|
$actions['paste']['children']["{$action_id}_paste"] = $action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anonymous users have limited actions
|
|
||||||
if(self::is_anonymous($GLOBALS['egw_info']['user']['account_id']))
|
|
||||||
{
|
|
||||||
self::restrict_anonymous_actions($actions);
|
|
||||||
}
|
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,6 +975,7 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
$row['class'] .= 'noEdit ';
|
$row['class'] .= 'noEdit ';
|
||||||
}
|
}
|
||||||
|
$row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : '';
|
||||||
$row['download_url'] = Vfs::download_url($path);
|
$row['download_url'] = Vfs::download_url($path);
|
||||||
$row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal
|
$row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal
|
||||||
|
|
||||||
@ -1450,21 +1446,6 @@ class filemanager_ui
|
|||||||
return $acl->check('anonymous', 1, 'phpgwapi');
|
return $acl->check('anonymous', 1, 'phpgwapi');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove some more dangerous actions
|
|
||||||
* @param Array $actions
|
|
||||||
*/
|
|
||||||
protected static function restrict_anonymous_actions(&$actions)
|
|
||||||
{
|
|
||||||
$remove = array(
|
|
||||||
'delete'
|
|
||||||
);
|
|
||||||
foreach($remove as $key)
|
|
||||||
{
|
|
||||||
unset($actions[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run given action on given path(es) and return array/object with values for keys 'msg', 'errs', 'dirs', 'files'
|
* Run given action on given path(es) and return array/object with values for keys 'msg', 'errs', 'dirs', 'files'
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user