fix profil empty path

This commit is contained in:
Fred Tempez 2023-10-06 09:16:49 +02:00
parent 70795358bd
commit 35a0bde533

View File

@ -678,8 +678,15 @@ class user extends common
// Nombre de profils de ce groupe // Nombre de profils de ce groupe
$group = $this->getInput('profilAddGroup'); $group = $this->getInput('profilAddGroup');
$profil = count($this->getData(['profil', $group])); $profil = count($this->getData(['profil', $group]));
// Vérifier le quota du nombre de profils dans le groupe // Gère le chemin
var_dump($profil < self::MAX_PROFILS); $fileManager = $this->getInput('profilAddFileManager', helper::FILTER_BOOLEAN);
$path = $this->getInput('profilAddPath');
if ($group <= self::GROUP_ADMIN
&& $fileManager
&& empty($path)
) {
$fileManager = false;
}
if ($profil < self::MAX_PROFILS) { if ($profil < self::MAX_PROFILS) {
$profil = (string) ($profil + 1); $profil = (string) ($profil + 1);
@ -689,7 +696,7 @@ class user extends common
'readonly' => false, 'readonly' => false,
'permanent' => false, 'permanent' => false,
'comment' => $this->getInput('profilAddComment', helper::FILTER_STRING_SHORT, true), 'comment' => $this->getInput('profilAddComment', helper::FILTER_STRING_SHORT, true),
'filemanager' => $this->getInput('profilAddFileManager', helper::FILTER_BOOLEAN), 'filemanager' => $fileManager,
'file' => [ 'file' => [
'download' => $this->getInput('profilAddDownload', helper::FILTER_BOOLEAN), 'download' => $this->getInput('profilAddDownload', helper::FILTER_BOOLEAN),
'edit' => $this->getInput('profilAddEdit', helper::FILTER_BOOLEAN), 'edit' => $this->getInput('profilAddEdit', helper::FILTER_BOOLEAN),
@ -709,7 +716,7 @@ class user extends common
'rename' => $this->getInput('profilAddFolderRename', helper::FILTER_BOOLEAN), 'rename' => $this->getInput('profilAddFolderRename', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilAddFolderCopycut', helper::FILTER_BOOLEAN), 'copycut' => $this->getInput('profilAddFolderCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilAddFolderChmod', helper::FILTER_BOOLEAN), 'chmod' => $this->getInput('profilAddFolderChmod', helper::FILTER_BOOLEAN),
'path' => $this->getInput('profilAddPath'), 'path' => $path,
], ],
'page' => [ 'page' => [
'add' => $this->getInput('profilAddPageAdd', helper::FILTER_BOOLEAN), 'add' => $this->getInput('profilAddPageAdd', helper::FILTER_BOOLEAN),