Disable delete action in context menu based on user rights not based on being anonymous

This commit is contained in:
Hadi Nategh 2017-11-07 12:19:57 +01:00
parent 662131b0d1
commit 7b0d92fabb

View File

@ -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'
*