From ce7c54c570778cd7b048ed5b65fe5ea24e15b83e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 21 Feb 2023 13:10:13 +0100 Subject: [PATCH] fix incoherence on permissions --- htdocs/modulebuilder/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d2fc01ddead..89dfc8694e3 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1262,6 +1262,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { \$this->rights[\$r][5] = 'delete'; \$r++; "; + $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectname).'*/'.$rightToadd."/*END ".strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); } } @@ -2036,7 +2037,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { // if not found permission for the object if (!in_array($objectForPerms, array_unique($allObject))) { $firstRight++; - $existRight = 0; + $existRight++; } if (!$error) { if (isModEnabled(strtolower($module))) { @@ -2058,11 +2059,10 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { "; $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; if (!$existRight) { - //var_dump(1);exit; dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/')); setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); } - if ($firstRight) { + if ($firstRight>0) { dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); } @@ -4720,8 +4720,8 @@ if ($module == 'initmodule') { print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print '';