From e8cfcd89521ed4a1d71547e9ad77e4b6ed81104e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 May 2008 00:03:58 +0000 Subject: [PATCH] Fix: Can manage permissions for module on 2 different roots --- htdocs/user/perms.php | 46 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 549bde019e1..96f60db5060 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -99,28 +99,34 @@ dolibarr_fiche_head($head, 'rights', $langs->trans("User")); $db->begin(); // Charge les modules soumis a permissions -$dir = DOL_DOCUMENT_ROOT . "/includes/modules/"; -$handle=opendir($dir); $modules = array(); -while (($file = readdir($handle))!==false) + +$listdir=array(); +$listdir[]=DOL_DOCUMENT_ROOT . "/includes/modules/"; +if (defined('DOL_DOCUMENT_ROOT_BIS') && DOL_DOCUMENT_ROOT_BIS) $listdir[]=DOL_DOCUMENT_ROOT_BIS . "/includes/modules/"; +foreach($listdir as $dir) { - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') - { - $modName = substr($file, 0, strlen($file) - 10); - - if ($modName) - { - include_once("../includes/modules/$file"); - $objMod = new $modName($db); - if ($objMod->rights_class) { - - $ret=$objMod->insert_permissions(); - - $modules[$objMod->rights_class]=$objMod; - //print "modules[".$objMod->rights_class."]=$objMod;"; - } - } - } + $handle=opendir($dir); + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') + { + $modName = substr($file, 0, strlen($file) - 10); + + if ($modName) + { + include_once($dir.$file); + $objMod = new $modName($db); + if ($objMod->rights_class) { + + $ret=$objMod->insert_permissions(); + + $modules[$objMod->rights_class]=$objMod; + //print "modules[".$objMod->rights_class."]=$objMod;"; + } + } + } + } } $db->commit();