diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index ef10e02598b..e10aae7ed85 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -98,7 +98,7 @@ foreach ($conf->file->dol_document_root as $dirroot) $objMod = new $modName($db); if ($objMod->rights_class) { - $ret=$objMod->insert_permissions(); + $ret=$objMod->insert_permissions(0); $modules[$objMod->rights_class]=$objMod; //print "modules[".$objMod->rights_class."]=$objMod;"; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 77a92667090..dd19d8a68ee 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -790,9 +790,14 @@ else print ''.$langs->trans("TestMailing").''; - if ($mil->statut == 0 && $user->rights->mailing->valider) + if ($mil->statut == 0) { - if ($mil->nbemail > 0) + print $user->rights->mailing->valider; + if (empty($user->rights->mailing->valider)) + { + print ''.$langs->trans("ValidMailing").''; + } + else if ($mil->nbemail > 0) { print ''.$langs->trans("ValidMailing").''; } diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 8f392b36e44..189d9c89b4e 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -99,8 +99,8 @@ class DolibarrModules // Insere les boites dans llx_boxes_def if (! $err && $options != 'noboxes') $err+=$this->insert_boxes(); - // Insere les permissions associees au module actif dans llx_rights_def - if (! $err) $err+=$this->insert_permissions(); + // Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user. + if (! $err) $err+=$this->insert_permissions(1); // Insere les constantes associees au module dans llx_const if (! $err) $err+=$this->insert_menus(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 84d5a979302..a8d411253c6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -443,10 +443,11 @@ class User extends CommonObject /** - * \brief Vide la tableau des droits de l'utilisateur + * \brief Clear all permissions array of user */ function clearrights() { + dol_syslog("User::clearrights reset user->rights"); $this->rights=''; $this->all_permissions_are_loaded=false; $this->tab_loaded=array(); diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index e2cb6026451..7a8974d25cd 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -103,7 +103,7 @@ if ($_GET["id"]) $objMod = new $modName($db); if ($objMod->rights_class) { - $ret=$objMod->insert_permissions(); + $ret=$objMod->insert_permissions(0); $modules[$objMod->rights_class]=$objMod; //print "modules[".$objMod->rights_class."]=$objMod;"; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index aadd702af41..c36deca038b 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -113,7 +113,7 @@ dol_fiche_head($head, 'rights', $title, 0, 'user'); $db->begin(); -// Charge les modules soumis a permissions +// Search all modules with permission and reload permissions def. $modules = array(); $listdir=$conf->file->dol_document_root; @@ -134,7 +134,7 @@ foreach($listdir as $dirroot) $objMod = new $modName($db); if ($objMod->rights_class) { - $ret=$objMod->insert_permissions(); + $ret=$objMod->insert_permissions(0); $modules[$objMod->rights_class]=$objMod; //print "modules[".$objMod->rights_class."]=$objMod;";