diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index c94e464a762..65fdcc96fa0 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -38,7 +38,7 @@ $langs->load("categories"); // Security check $socid = (int) GETPOST('socid', 'int'); -if (!$user->rights->categorie->lire) { +if (!$user->hasRight('categorie', 'lire')) { accessforbidden(); } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 21be2954d3f..69747248906 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -49,7 +49,7 @@ if (is_numeric($type)) { // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('categoryindex')); -if (!$user->rights->categorie->lire) { +if (!$user->hasRight('categorie', 'lire')) { accessforbidden(); } diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index 81685a51e7b..f5f63091f9c 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; -if (!$user->rights->categorie->lire) { +if (!$user->hasRight('categorie', 'lire')) { accessforbidden(); } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 31a5dd5692e..cccb90052df 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -691,7 +691,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $deleteok = 0; } } elseif ($feature == 'produit|service') { - if (!$user->rights->produit->supprimer && !$user->rights->service->supprimer) { + if (!$user->hasRight('produit', 'supprimer') && !$user->hasRight('service', 'supprimer')) { $deleteok = 0; } } elseif ($feature == 'commande_fournisseur') { diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index b35e7748570..c73a2dcfb9f 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -51,7 +51,7 @@ if (empty($modulepart)) { $accessallowed = 0; if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service') { $result = restrictedArea($user, 'produit|service', $id, 'product&product'); - if ($modulepart == 'produit|service' && (!$user->rights->produit->lire && !$user->rights->service->lire)) { + if ($modulepart == 'produit|service' && (!$user->hasRight('produit', 'lire') && !$user->hasRight('service', 'lire'))) { accessforbidden(); } $accessallowed = 1; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index e2b8b7a306f..d88013fb8d1 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_year = ''; } -if (!$user->rights->produit->lire) accessforbidden(); +if (!$user->hasRight('produit', 'lire')) accessforbidden(); /* diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index 29dd7a5b6d9..991f3a0d665 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_year = ''; } -if (!$user->rights->produit->lire) accessforbidden(); +if (!$user->hasRight('produit', 'lire')) accessforbidden(); /* diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index 7609cdaf346..5355d9e9cff 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -74,7 +74,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_year = ''; } -if (!$user->rights->produit->lire) accessforbidden(); +if (!$user->hasRight('produit', 'lire')) accessforbidden(); /* diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index f423e7a1f5a..0ee2219cbce 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -81,7 +81,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_year = ''; } -if (!$user->rights->produit->lire) accessforbidden(); +if (!$user->hasRight('produit', 'lire')) accessforbidden(); /* diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index 9597c7262e2..e851573cba4 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -47,7 +47,7 @@ if (is_numeric($type)) { $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility } -if (!$user->rights->categorie->lire) { +if (!$user->hasRight('categorie', 'lire')) { accessforbidden(); } diff --git a/htdocs/zapier/admin/about.php b/htdocs/zapier/admin/about.php index 71120a384a2..cacda3dc0da 100644 --- a/htdocs/zapier/admin/about.php +++ b/htdocs/zapier/admin/about.php @@ -42,7 +42,7 @@ if (!$user->admin) { accessforbidden(); } -if (empty($conf->zapier->enabled)) accessforbidden(); +if (!isModEnabled('zapier')) accessforbidden(); if (empty($user->admin)) accessforbidden(); diff --git a/htdocs/zapier/admin/setup.php b/htdocs/zapier/admin/setup.php index 6fe6365d1b9..26b961321a7 100644 --- a/htdocs/zapier/admin/setup.php +++ b/htdocs/zapier/admin/setup.php @@ -46,7 +46,7 @@ $arrayofparameters = array( // 'ZAPIERFORDOLIBARR_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1) ); -if (empty($conf->zapier->enabled)) accessforbidden(); +if (!isModEnabled('zapier')) accessforbidden(); if (empty($user->admin)) accessforbidden();