Fix permission to create a holiday when advanced permissions are set

This commit is contained in:
Laurent Destailleur 2021-03-09 19:51:11 +01:00
parent 9cb4dce485
commit 67f5837072

View File

@ -148,7 +148,10 @@ if (empty($reshook))
$description = trim(GETPOST('description', 'restricthtml'));
// Check that leave is for a user inside the hierarchy or advanced permission for all is set
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->write)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->writeall_advance))) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->write))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->id == $fuserid && empty($user->rights->holiday->write))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->id != $fuserid && empty($user->rights->holiday->writeall_advance))
) {
$error++;
setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors');
} else {