* Filemanager: When user tries to access a directory with no permission, redirect to previous directory instead of home

This commit is contained in:
nathangray 2020-06-08 10:18:15 -06:00
parent 18852b91bc
commit 8778be01ff
2 changed files with 20 additions and 14 deletions

View File

@ -905,6 +905,8 @@ class filemanager_ui
*/
function get_rows(&$query, &$rows)
{
$old_session = Api\Cache::getSession('filemanager','index');
// do NOT store query, if hierarchical data / children are requested
if (!$query['csv_export'])
{
@ -933,15 +935,19 @@ class filemanager_ui
if (!Vfs::stat($query['path'],true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'],Vfs::READABLE))
{
// only redirect, if it would be to some other location, gives redirect-loop otherwise
if ($query['path'] != ($path = static::get_home_dir()))
foreach([$old_session['path'], static::get_home_dir()] as $new_path)
{
if ($new_path && Vfs::stat($new_path) && $query['path'] != $new_path)
{
// we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give
// an appropriate message
Egw::redirect_link('/index.php', array('menuaction' => 'filemanager.filemanager_ui.index',
'path' => $path,
'path' => $new_path,
'msg' => lang('The requested path %1 is not available.', Vfs::decodePath($query['path'])),
'ajax' => 'true'
));
break;
}
}
$rows = array();
return 0;
@ -971,6 +977,10 @@ class filemanager_ui
{
$row['class'] .= 'noEdit ';
}
if(!Vfs::is_executable($path))
{
$row['class'] .= 'noExecute';
}
}
elseif (!$dir_is_writable[Vfs::dirname($path)])
{

View File

@ -103,15 +103,11 @@
<rows>
<row>
<description value="User"/>
<menulist>
<menupopup type="select-account" label="@ro_uid_root" id="uid" options="root,accounts"/>
</menulist>
<select-account label="@ro_uid_root" id="uid" empty_label="root" account_type="accounts"/>
</row>
<row>
<description value="Group"/>
<menulist>
<menupopup type="select-account" label="@ro_gid_root" id="gid" options="root,groups"/>
</menulist>
<select-account label="@ro_gid_root" id="gid" empty_label="root" account_type="groups"/>
</row>
</rows>
</grid>