diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 8d03c029cd6..0b1b83c46ef 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other')); // Access Control -if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) { +if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->blockedlog->enabled)) { accessforbidden(); } diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index db0faa50cc1..8660ebbbc82 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; $id = GETPOST('id', 'int'); $block = new BlockedLog($db); -if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) { +if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->blockedlog->enabled)) { accessforbidden(); } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f232ecc7d97..94e9ca8ca75 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1407,7 +1407,7 @@ class ActionComm extends CommonObject if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".((int) $user->id); } $sql .= " WHERE 1 = 1"; @@ -1421,7 +1421,7 @@ class ActionComm extends CommonObject if ($user->socid) { $sql .= " AND a.fk_soc = ".((int) $user->socid); } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id); $sql .= " OR ar.fk_element = ".((int) $user->id); $sql .= ")"; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 17bbaef93bf..744253208b9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -91,13 +91,13 @@ if ($socid < 0) { } $canedit = 1; -if (empty($user->rights->agenda->myactions->read)) { +if (!$user->hasRight('agenda', 'myactions', 'read')) { accessforbidden(); } -if (empty($user->rights->agenda->allactions->read)) { +if (!$user->hasRight('agenda', 'allactions', 'read')) { $canedit = 0; } -if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me +if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me $filtert = $user->id; } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index f9f25a6fcff..e67d2bdc89c 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -144,13 +144,13 @@ if ($socid < 0) { } $canedit = 1; -if (empty($user->rights->agenda->myactions->read)) { +if (!$user->hasRight('agenda', 'myactions', 'read')) { accessforbidden(); } -if (empty($user->rights->agenda->allactions->read)) { +if (!$user->hasRight('agenda', 'allactions', 'read')) { $canedit = 0; } -if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me +if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me $filtert = $user->id; } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 9d3bd0044e4..6c8925869e8 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -89,13 +89,13 @@ if ($socid < 0) { // Permissions $canedit = 1; -if (empty($user->rights->agenda->myactions->read)) { +if (!$user->hasRight('agenda', 'myactions', 'read')) { accessforbidden(); } -if (empty($user->rights->agenda->allactions->read)) { +if (!$user->hasRight('agenda', 'allactions', 'read')) { $canedit = 0; } -if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me +if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me $filtert = $user->id; } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index a2b1aad9d6a..7af29fdc84a 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -85,13 +85,13 @@ if ($socid < 0) { } $canedit = 1; -if (empty($user->rights->agenda->myactions->read)) { +if (!$user->hasRight('agenda', 'myactions', 'read')) { accessforbidden(); } -if (empty($user->rights->agenda->allactions->read)) { +if (!$user->hasRight('agenda', 'allactions', 'read')) { $canedit = 0; } -if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me +if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me $filtert = $user->id; } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 5b58511817e..840d6c06ffc 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -105,7 +105,7 @@ class box_actions extends ModeleBoxes if ($user->socid) { $sql .= " AND s.rowid = ".((int) $user->socid); } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")"; } $sql .= " ORDER BY a.datep ASC"; diff --git a/htdocs/core/boxes/box_actions_future.php b/htdocs/core/boxes/box_actions_future.php index e45322d9efe..61a40938b8c 100644 --- a/htdocs/core/boxes/box_actions_future.php +++ b/htdocs/core/boxes/box_actions_future.php @@ -107,7 +107,7 @@ class box_actions_future extends ModeleBoxes if ($user->socid) { $sql .= " AND s.rowid = ".((int) $user->socid); } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")"; } $sql .= " AND a.datep > '".$this->db->idate($now)."'"; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 63e619a2370..f3d237c35dd 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -480,7 +480,7 @@ class modAgenda extends DolibarrModules if (empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR ac.fk_soc IS NULL)'; } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $this->export_sql_end[$r] .= ' AND acr.fk_element = '.(empty($user) ? 0 : $user->id); } $this->export_sql_order[$r] = ' ORDER BY ac.datep'; diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 4d4d482db50..ae1b98e63f7 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -402,7 +402,7 @@ class modEventOrganization extends DolibarrModules if (empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR ac.fk_soc IS NULL)'; } - if (empty($user->rights->agenda->allactions->read)) { + if (!$user->hasRight('agenda', 'allactions', 'read')) { $this->export_sql_end[$r] .= ' AND acr.fk_element = '.(empty($user) ? 0 : $user->id); } $this->export_sql_order[$r] = ' ORDER BY ac.datep';