From f002fb4ed132ab5eeabe3b161b31eb8e1009fc4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 10:36:43 +0200 Subject: [PATCH] Use the non deprecated function loadRights instead of getrights --- htdocs/api/class/api_access.class.php | 2 +- htdocs/api/class/api_login.class.php | 2 +- htdocs/core/lib/ws.lib.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- htdocs/dav/fileserver.php | 2 +- htdocs/ecm/search.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/imports/emptyexample.php | 2 +- htdocs/main.inc.php | 2 +- htdocs/modulebuilder/template/css/mymodule.css.php | 4 +--- htdocs/modulebuilder/template/scripts/mymodule.php | 2 +- .../template/test/phpunit/MyObjectTest.php | 2 +- htdocs/public/agenda/agendaexport.php | 4 ++-- htdocs/public/cron/cron_run_jobs_by_url.php | 4 ++-- htdocs/public/stripe/ipn.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- htdocs/user/agenda.php | 2 +- htdocs/user/agenda_extsites.php | 2 +- htdocs/user/bank.php | 2 +- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 5 +++-- htdocs/user/clicktodial.php | 2 +- htdocs/user/document.php | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/group/ldap.php | 2 +- htdocs/user/group/perms.php | 6 +++--- htdocs/user/ldap.php | 2 +- htdocs/user/messaging.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/notify/card.php | 4 ++-- htdocs/user/param_ihm.php | 2 +- htdocs/user/perms.php | 10 +++++----- htdocs/user/virtualcard.php | 2 +- htdocs/webservices/server_actioncomm.php | 4 ++-- htdocs/webservices/server_category.php | 2 +- htdocs/webservices/server_contact.php | 2 +- htdocs/webservices/server_invoice.php | 4 ++-- htdocs/webservices/server_order.php | 4 ++-- htdocs/webservices/server_other.php | 2 +- htdocs/webservices/server_productorservice.php | 4 ++-- htdocs/webservices/server_project.php | 4 ++-- htdocs/webservices/server_supplier_invoice.php | 2 +- htdocs/webservices/server_thirdparty.php | 4 ++-- htdocs/webservices/server_user.php | 6 +++--- 48 files changed, 67 insertions(+), 68 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index fb074a8b32d42..1355261d0ef17 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -200,7 +200,7 @@ public function __isAllowed() } // User seems valid - $fuser->getrights(); + $fuser->loadRights(); // Set the property $user to the $user of API static::$user = $fuser; diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 77f337743fc30..810c0829952d8 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -144,7 +144,7 @@ public function index($login, $password, $entity = '', $reset = 0) // Renew the hash if (empty($tmpuser->api_key) || $reset) { - $tmpuser->getrights(); + $tmpuser->loadRights(); if (!$tmpuser->hasRight('user', 'self', 'creer')) { if (empty($tmpuser->api_key)) { throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token'); diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index f2f39b2eddf4b..2efffff73af25 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -72,7 +72,7 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe // Validation of login if (!$error) { - $fuser->getrights(); // Load permission of user + $fuser->loadRights(); // Load permission of user // Authentication mode if (empty($dolibarr_main_authentication)) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 88232c594f0c6..8bc05ad4a545c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2019,7 +2019,7 @@ public function insert_permissions($reinitadminperms = 0, $force_entity = null, if (!empty($reinitadminperms) && !empty($user->admin)) { // Reload permission for current user if defined // We reload permissions $user->clearrights(); - $user->getrights(); + $user->loadRights(); } } $this->db->free($resql); diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 6911838834e2d..756639438f627 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -58,7 +58,7 @@ $user = new User($db); if (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') { $user->fetch(0, $_SERVER['PHP_AUTH_USER']); - $user->getrights(); + $user->loadRights(); } // Load translation files required by the page diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 202ea14afb741..2910d7a418441 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -40,7 +40,7 @@ $result = restrictedArea($user, 'ecm', ''); // Load permissions -$user->getrights('ecm'); +$user->loadRights('ecm'); // Get parameters $socid = GETPOSTINT('socid'); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 57b80393617f4..8cec82fcb6d90 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2743,7 +2743,7 @@ public function computeTotalKm($fk_cat, $qty, $tva) $currentUser = new User($db); $currentUser->fetch($this->fk_user); - $currentUser->getrights('expensereport'); + $currentUser->loadRights('expensereport'); //Clean $qty = (float) price2num($qty); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index a66ee7c4b161f..3e5ca842ec8ef 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -271,7 +271,7 @@ if ($id > 0) { // Charge utilisateur edite $fuser->fetch($id, '', '', 1); - $fuser->getrights(); + $fuser->loadRights(); $user_id = $fuser->id; $search_user = $user_id; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index ee6ca36224a7d..91d50316771f3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -256,7 +256,7 @@ $userstatic = new User($db); $userstatic->id = $obj->rowid; - $userstatic->getrights('fournisseur'); + $userstatic->loadRights('fournisseur'); if ($userstatic->hasRight('fournisseur', 'commande', 'approuver')) { print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 6baf24ccb2462..16aad58d970c2 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -253,7 +253,7 @@ if ($id > 0) { // Charge utilisateur edite $fuser->fetch($id, '', '', 1); - $fuser->getrights(); + $fuser->loadRights(); $user_id = $fuser->id; $search_employee = $user_id; diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index ec84e98e7145e..7f72904e13d06 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -79,7 +79,7 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = // Check exportkey if (empty($datatoimport)) { - $user->getrights(); + $user->loadRights(); llxHeader(); print '
Bad value for datatoimport.
'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 399cb9030f147..a26222d051c9e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1471,7 +1471,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1) } // Load permissions - $user->getrights(); + $user->loadRights(); } dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09').(defined('NOTOKENRENEWAL') ? ' NOTOKENRENEWAL='.constant('NOTOKENRENEWAL') : ''), LOG_NOTICE); diff --git a/htdocs/modulebuilder/template/css/mymodule.css.php b/htdocs/modulebuilder/template/css/mymodule.css.php index d805158c1145d..f243960eceeac 100644 --- a/htdocs/modulebuilder/template/css/mymodule.css.php +++ b/htdocs/modulebuilder/template/css/mymodule.css.php @@ -81,7 +81,7 @@ // Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS /*if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('',$_SESSION['dol_login']); - $user->getrights(); + $user->loadRights(); }*/ @@ -107,5 +107,3 @@ .myclasscss { /* ... */ } - - diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 9bb5d54cfa506..1f59f3a602c17 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -105,7 +105,7 @@ dol_print_error(null, $user->error); exit; } -$user->getrights(); +$user->loadRights(); $hookmanager->initHooks(array('cli')); diff --git a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php index 89b2e3db55466..97861ddf147b6 100644 --- a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php @@ -34,7 +34,7 @@ if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; $user->fetch(1); - $user->getrights(); + $user->loadRights(); } $conf->global->MAIN_DISABLE_ALL_MAILS = 1; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 284dfd6091ea7..718c97e03edab 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -162,7 +162,7 @@ function llxFooterVierge() // Check config if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { - $user->getrights(); + $user->loadRights(); top_httphead(); @@ -189,7 +189,7 @@ function llxFooterVierge() } elseif (empty($reshook)) { // Check exportkey if (!GETPOST("exportkey") || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != GETPOST("exportkey")) { - $user->getrights(); + $user->loadRights(); top_httphead(); diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 3185f7bfa558e..86c0cc7629957 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -118,7 +118,7 @@ exit; } } -$user->getrights(); +$user->loadRights(); $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. @@ -180,7 +180,7 @@ exit(-1); } } - $user->getrights(); + $user->loadRights(); } } diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 787a1474904a3..b7cec54d44caf 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -93,7 +93,7 @@ // We set the user to use for all ipn actions in Dolibarr $user = new User($db); $user->fetch(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS')); - $user->getrights(); + $user->loadRights(); } else { httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.', 400, 1); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 33266aeaad855..7b65ab171b65c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -69,7 +69,7 @@ // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); - $user->getrights(); + $user->loadRights(); // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8b7eac9d3e26c..8e8d4083dd931 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -71,7 +71,7 @@ // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); - $user->getrights(); + $user->loadRights(); //$user->loadPersonalConf(); // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index 5b8cf4ffe56bd..41f128cd68e55 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -72,7 +72,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } // Security check diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index c3fc53bea3f71..9c435ca8485fc 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -59,7 +59,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Security check $socid = 0; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 1a667909ad55b..d6d857f0f27ea 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -71,7 +71,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } $account = new UserBankAccount($db); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a17d32c5f582d..b0d64602e214d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1437,7 +1437,7 @@ // Check if user has rights if (!getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { - $object->getrights(); + $object->loadRights(); if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin)) { setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1f2374dffdf60..df1d2e782f0a3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1299,7 +1299,7 @@ public function loadRights($moduletag = '', $forcereload = 0) $sql .= " ".$this->db->prefix()."usergroup_user as gu,"; $sql .= " ".$this->db->prefix()."rights_def as r"; $sql .= " WHERE r.id = gr.fk_id"; - // @FIXME Very strange business rules. Must be alays the same than into user->getrights() user/perms.php and user/group/perms.php + // @FIXME Very strange business rules. Must be always the same than into user->loadRights() user/perms.php and user/group/perms.php if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { $sql .= " AND gu.entity IN (0,".$conf->entity.")"; @@ -1443,11 +1443,12 @@ public function loadRights($moduletag = '', $forcereload = 0) /** * Load permissions granted to a user->id into object user->rights - * TODO Remove this method. It has a name conflict with getRights() in CommonObject. + * TODO Remove this method. It has a name conflict with getRights() in CommonObject and was replaced in v20 with loadRights() * * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) * @param int $forcereload Force reload of permissions even if they were already loaded (ignore cache) * @return void + * @deprecated * * @see clearrights(), delrights(), addrights(), hasRight() * @phpstan-ignore-next-line diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 0b67de7d1978d..6b540e1f40733 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -81,7 +81,7 @@ if ($id > 0) { $object = new User($db); $object->fetch($id, '', '', 1); - $object->getrights(); + $object->loadRights(); $object->fetch_clicktodial(); $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 668890e0c91ea..06b51074c9549 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -102,7 +102,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); //$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; // For users, the upload_dir is always $conf->user->entity for the moment $upload_dir = $conf->user->dir_output."/".$object->id; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 51386fc3a0724..22a6db65cdb4b 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -68,7 +68,7 @@ // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. -$object->getrights(); +$object->loadRights(); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('groupcard', 'globalcard')); diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 2bb9b4b2fac45..7149862bb15fe 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -44,7 +44,7 @@ $object = new UserGroup($db); $object->fetch($id, '', true); -$object->getrights(); +$object->loadRights(); // Users/Groups management only in master entity if transverse mode if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 58c254d2717f2..8166525316b21 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -74,7 +74,7 @@ $object = new UserGroup($db); $object->fetch($id); -$object->getrights(); +$object->loadRights(); $entity = $conf->entity; @@ -106,7 +106,7 @@ } $user->clearrights(); - $user->getrights(); + $user->loadRights(); } if ($action == 'delrights' && $caneditperms) { @@ -122,7 +122,7 @@ } $user->clearrights(); - $user->getrights(); + $user->loadRights(); } } diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 45549a292486e..a40826c632f51 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -47,7 +47,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('usercard', 'userldap', 'globalcard')); diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index eabf89a25b3f8..713c7f83b343e 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -80,7 +80,7 @@ if ($result <= 0) { accessforbidden('User not found'); } - $object->getrights(); + $object->loadRights(); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 4fe5dd7e8de49..c6db1416a7b02 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -42,7 +42,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // If user is not user read and no permission to read other users, we stop if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index f0027bc3b2e97..c0e20fb88932e 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -69,7 +69,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } $permissiontoadd = (($object->id == $user->id) || ($user->hasRight('user', 'user', 'lire'))); @@ -141,7 +141,7 @@ $object = new User($db); $result = $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification"); if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index b401d90863f15..e97beefcde0bf 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -69,7 +69,7 @@ // Charge utilisateur edite $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Liste des zone de recherche permanentes supportees /* deprecated diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index d553851236a2c..03d63465a01dc 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -81,7 +81,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); $entity = $conf->entity; @@ -111,12 +111,12 @@ // If we are changing our own permissions, we reload permissions and menu if ($object->id == $user->id) { $user->clearrights(); - $user->getrights(); + $user->loadRights(); $menumanager->loadMenu(); } $object->clearrights(); - $object->getrights(); + $object->loadRights(); } if ($action == 'delrights' && $caneditperms && $confirm == 'yes') { @@ -130,12 +130,12 @@ // If we are changing our own permissions, we reload permissions and menu if ($object->id == $user->id) { $user->clearrights(); - $user->getrights(); + $user->loadRights(); $menumanager->loadMenu(); } $object->clearrights(); - $object->getrights(); + $object->loadRights(); } } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index b519b6d67bf26..d2d180ba5a24b 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -44,7 +44,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } // Security check diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index b1666442c0181..d17e6682ebecf 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -297,7 +297,7 @@ function getActionComm($authentication, $id) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('agenda', 'allactions', 'read')) { $actioncomm = new ActionComm($db); @@ -393,7 +393,7 @@ function getListActionCommType($authentication) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('agenda', 'myactions', 'read')) { $cactioncomm = new CActionComm($db); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index ee681c18c738f..b584b88c09194 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -231,7 +231,7 @@ function getCategory($authentication, $id) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('categorie', 'lire')) { diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index d632ec121b7fd..c9f74cc8f5883 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -289,7 +289,7 @@ function getContact($authentication, $id, $ref_ext) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); $contact = new Contact($db); $result = $contact->fetch($id, null, $ref_ext); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index bb4d104c18d04..aa25ba56d18fe 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -330,7 +330,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('facture', 'lire')) { $invoice = new Facture($db); @@ -698,7 +698,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' ////////////////////// if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 8c75b40dfacd8..b73d2bef2fff5 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -407,7 +407,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); @@ -831,7 +831,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 6fe3799c25385..4d23b21c1a669 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -243,7 +243,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); // Suppression de la chaine de character ../ dans $original_file $original_file = str_replace("../", "/", $original_file); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 3d5ce1d17a2d1..443dc4ee53fd9 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -392,7 +392,7 @@ function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '', $langcode = ($lang ? $lang : (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('produit', 'lire') || $fuser->hasRight('service', 'lire')) { @@ -1029,7 +1029,7 @@ function getProductsForCategory($authentication, $id, $lang = '') $langcode = ($lang ? $lang : (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('produit', 'lire')) { diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index d254fa870f206..5e731ece5ce2a 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -281,7 +281,7 @@ function createProject($authentication, $project) if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('projet', 'creer')) { $newobject = new Project($db); @@ -376,7 +376,7 @@ function getProject($authentication, $id = '', $ref = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('projet', 'lire')) { $project = new Project($db); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 77442df3f0385..482dbb7420643 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -267,7 +267,7 @@ function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('fournisseur', 'facture', 'lire')) { $invoice = new FactureFournisseur($db); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index d53ee73ac9d3e..83e2acffa769f 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -339,7 +339,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'lire')) { $thirdparty = new Societe($db); @@ -845,7 +845,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') dol_syslog("Function: deleteThirdParty 1"); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'lire') && $fuser->hasRight('societe', 'supprimer')) { $thirdparty = new Societe($db); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 1ffc7458d736a..fd6a4e96f14f6 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -354,7 +354,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('user', 'user', 'lire') || ($fuser->hasRight('user', 'self', 'creer') && $id && $id == $fuser->id) @@ -517,7 +517,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'creer')) { $thirdparty = new Societe($db); @@ -716,7 +716,7 @@ function setUserPassword($authentication, $shortuser) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('user', 'user', 'password') || $fuser->hasRight('user', 'self', 'password')) { $userstat = new User($db);