From 7b0d92fabbb8b4a2167422603e1930dc7f5cd4cb Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 7 Nov 2017 12:19:57 +0100 Subject: [PATCH] Disable delete action in context menu based on user rights not based on being anonymous --- filemanager/inc/class.filemanager_ui.inc.php | 23 ++------------------ 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index c9709b3074..f612cfe2eb 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -248,6 +248,7 @@ class filemanager_ui 'group' => ++$group, 'confirm' => 'Delete these files or directories?', 'onExecute' => 'javaScript:app.filemanager.action', + 'disableClass' => 'noDelete' ), // DRAG and DROP events 'file_drag' => array( @@ -317,12 +318,6 @@ class filemanager_ui $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; } @@ -980,6 +975,7 @@ class filemanager_ui { $row['class'] .= 'noEdit '; } + $row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : ''; $row['download_url'] = Vfs::download_url($path); $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'); } - /** - * 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' *