Filemanager: Don't allow permission changes (through UI) on /, /home or /apps since it tends to cause problems

This commit is contained in:
nathangray 2021-04-13 11:14:44 -06:00
parent 574e7150c7
commit 140e5a2871

View File

@ -1369,6 +1369,19 @@ class filemanager_ui
$readonlys['comment'] = !Vfs::is_writable($path); $readonlys['comment'] = !Vfs::is_writable($path);
$readonlys['tabs']['filemanager.file.preview'] = $readonlys['tabs']['filemanager.file.perms'] = $content['is_link']; $readonlys['tabs']['filemanager.file.preview'] = $readonlys['tabs']['filemanager.file.perms'] = $content['is_link'];
// Don't allow permission changes for these, even for root - it causes too many problems.
// Use the CLI if you really need to make changes
if(in_array($content['path'], ['/','/home','/apps']))
{
foreach($content['perms'] as $name => $value)
{
$readonlys['perms['.$name.']'] = true;
}
$readonlys['gid'] = true;
$readonlys['uid'] = true;
$readonlys['modify_subs'] = true;
}
// if neither owner nor is writable --> disable save&apply // if neither owner nor is writable --> disable save&apply
$readonlys['button[save]'] = $readonlys['button[apply]'] = !$content['is_owner'] && !Vfs::is_writable($path); $readonlys['button[save]'] = $readonlys['button[apply]'] = !$content['is_owner'] && !Vfs::is_writable($path);