dolibarr 24.0.0-beta
perms.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
6 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
11 * Copyright (C) 2025-2026 Charlene Benke <charlene@patas-monkey.com>
12 * Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27
33if (!defined('CSRFCHECK_WITH_TOKEN')) {
34 define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
35}
36
37// Load Dolibarr environment
38require '../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
49require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
50
51// Load translation files required by page
52$langs->loadLangs(array('users', 'admin'));
53
54$id = GETPOSTINT('id');
55$action = GETPOST('action', 'aZ09');
56$confirm = GETPOST('confirm', 'alpha');
57$module = GETPOST('module', 'alpha');
58$rights = GETPOSTINT('rights');
59$updatedmodulename = GETPOST('updatedmodulename', 'alpha');
60$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search
61
62if (!isset($id) || empty($id)) {
64}
65
66// Define if user can read permissions
67$canreaduser = ($user->admin || $user->hasRight("user", "user", "read"));
68// Define if user can modify other users and permissions
69$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
70// Advanced permissions
71if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
72 $canreaduser = ($user->admin || ($user->hasRight("user", "user", "read") && $user->hasRight("user", "user_advance", "readperms")));
73 $caneditselfperms = ($user->id == $id && $user->hasRight("user", "self_advance", "writeperms"));
74 $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
75}
76
77// Security check
78$socid = 0;
79if (!empty($user->socid) && $user->socid > 0) {
80 $socid = $user->socid;
81}
82$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
83// A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin
84if ($user->id == $id && (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight("user", "self_advance", "readperms") && empty($user->admin))) {
86}
87
88// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
89$hookmanager->initHooks(array('usercard', 'userperms', 'globalcard'));
90
91$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
92if ($user->id != $id && !$canreaduser) {
94}
95
96$object = new User($db);
97$object->fetch($id, '', '', 1);
98$object->loadRights();
99
100$entity = $conf->entity;
101
102
103/*
104 * Actions
105 */
106
107$parameters = array('socid' => $socid);
108$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
109if ($reshook < 0) {
110 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
111}
112
113if (empty($reshook)) {
114 if ($action == 'addrights' && $caneditperms && $confirm == 'yes') {
115 $edituser = new User($db);
116 $edituser->fetch($object->id);
117 $result = $edituser->addrights($rights, $module, '', $entity);
118 if ($result < 0) {
119 setEventMessages($edituser->error, $edituser->errors, 'errors');
120 }
121
122 // If we are changing our own permissions, we reload permissions and menu
123 if ($object->id == $user->id) {
124 $user->clearrights();
125 $user->loadRights();
126 // @phan-suppress-next-line PhanRedefinedClassReference
127 $menumanager->loadMenu();
128 }
129
130 $object->clearrights();
131 $object->loadRights();
132
133 // We redirect to avoid to get an URL with token inside
134 $qs = $_SERVER["QUERY_STRING"];
135 $qs = preg_replace('/&action=addrights/', '', $qs);
136 $qs = preg_replace('/&token=[0-9a-f]+/i', '', $qs);
137 $qs = preg_replace('/&confirm=yes/', '', $qs);
138 //var_dump($qs);exit;
139 header("Location: ".$_SERVER["PHP_SELF"].($qs ? "?".$qs : ""));
140 exit;
141 }
142
143 if ($action == 'delrights' && $caneditperms && $confirm == 'yes') {
144 $edituser = new User($db);
145 $edituser->fetch($object->id);
146 $result = $edituser->delrights($rights, $module, '', $entity);
147 if ($result < 0) {
148 setEventMessages($edituser->error, $edituser->errors, 'errors');
149 }
150
151 // If we are changing our own permissions, we reload permissions and menu
152 if ($object->id == $user->id) {
153 $user->clearrights();
154 $user->loadRights();
155 // @phan-suppress-next-line PhanRedefinedClassReference
156 $menumanager->loadMenu();
157 }
158
159 $object->clearrights();
160 $object->loadRights();
161
162 // We redirect to avoid to get an URL with token inside
163 $qs = $_SERVER["QUERY_STRING"];
164 $qs = preg_replace('/&action=delrights/', '', $qs);
165 $qs = preg_replace('/&token=[0-9a-f]+/i', '', $qs);
166 $qs = preg_replace('/&confirm=yes/', '', $qs);
167 header("Location: ".$_SERVER["PHP_SELF"].($qs ? "?".$qs : ""));
168 exit;
169 }
170}
171
172$db->begin();
173
174// Search all modules with permission and reload permissions def.
175$modules = array();
176$modulesdir = dolGetModulesDirs();
177
178// Modules to ignore depending on supplier module mode
179$excludedModules = getDolGlobalInt('MAIN_USE_NEW_SUPPLIERMOD') ? array('modFournisseur') : array('modSupplierOrder', 'modSupplierInvoice');
180
181foreach ($modulesdir as $dir) {
182 $handle = @opendir(dol_osencode($dir));
183 if (is_resource($handle)) {
184 while (($file = readdir($handle)) !== false) {
185 if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
186 $modName = substr($file, 0, dol_strlen($file) - 10);
187
188 if ($modName) {
189 // Exclude old/new supplier descriptors depending on MAIN_USE_NEW_SUPPLIERMOD
190 if (in_array($modName, $excludedModules, true)) {
191 continue;
192 }
193
194 include_once $dir.$file;
195 $objMod = new $modName($db);
196 '@phan-var-force DolibarrModules $objMod';
199 // Load all lang files of module
200 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
201 foreach ($objMod->langfiles as $domain) {
202 $langs->load($domain);
203 }
204 }
205 // Load all permissions
206 if ($objMod->rights_class) {
207 $objMod->insert_permissions(0, $entity);
208 $modules[$objMod->rights_class] = $objMod;
209 //print "modules[".$objMod->rights_class."]=$objMod;";
210 }
211 }
212 }
213 }
214 }
215}
216
217$db->commit();
218
219'@phan-var-force DolibarrModules[] $modules';
220
221
222// Fix bad value for module_position in table
223// ------------------------------------------
224$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.family, r.family_position, r.bydefault";
225$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
226$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
227$sql .= " AND r.entity = ".((int) $entity);
228$sql .= " ORDER BY r.family, r.family_position, r.module_position, r.module, r.id";
229
230$result = $db->query($sql);
231if ($result) {
232 $num = $db->num_rows($result);
233 $i = 0;
234
235 while ($i < $num) {
236 $obj = $db->fetch_object($result);
237
238 // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
239 if (!isset($obj->module) || empty($modules[$obj->module])) {
240 $i++;
241 continue;
242 }
243
244 // Special cases
245 if (isModEnabled("reception")) {
246 // The 2 permissions in vendor modules are replaced by the 2 permissions into reception module
247 if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
248 $i++;
249 continue;
250 }
251 if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
252 $i++;
253 continue;
254 }
255 }
256
257 $objMod = $modules[$obj->module];
258 // $objMod is necessarily an object here
259
260 // Save field module_position in database if value is undefined or wrong (old data/version)
261 if (empty($obj->module_position) || ($objMod->isCoreOrExternalModule() == 'external' && $obj->module_position < 100000)) {
262 if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
263 // TODO Define familyposition
264 //$familyposition = $modules[$obj->module]->family_position;
265 $familyposition = 0;
266
267 $newmoduleposition = $modules[$obj->module]->module_position;
268
269 // Correct $newmoduleposition position for external modules
270 $objMod = $modules[$obj->module];
271 if (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $newmoduleposition < 100000) {
272 $newmoduleposition += 100000;
273 }
274
275 $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".((int) $newmoduleposition).",";
276 $sqlupdate .= " family_position = ".((int) $familyposition);
277 $sqlupdate .= " WHERE module_position = ".((int) $obj->module_position)." AND module = '".$db->escape($obj->module)."'";
278
279 $db->query($sqlupdate);
280 }
281 }
282
283 // Save field family in database if value is undefined (old data/version)
284 if (empty($obj->family) && !empty($objMod->family)) {
285 $newfamily = $objMod->family;
286 $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET family = '".$db->escape($newfamily)."'";
287 $sqlupdate .= " WHERE id = ".((int) $obj->id);
288
289 $db->query($sqlupdate);
290 }
291 }
292} else {
294}
295
296
297/*
298 * View
299 */
300
301$form = new Form($db);
302
303$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
304$title = $person_name." - ".$langs->trans('Permissions');
305$help_url = '';
306llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-card_perms');
307
309
310$title = $langs->trans("User");
311print dol_get_fiche_head($head, 'rights', $title, -1, 'user');
312
313// Read permissions of edited user
314$permsuser = array();
315
316$sql = "SELECT ur.fk_id";
317$sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
318$sql .= " WHERE ur.entity = ".((int) $entity);
319$sql .= " AND ur.fk_user = ".((int) $object->id);
320
321dol_syslog("get user perms", LOG_DEBUG);
322$result = $db->query($sql);
323if ($result) {
324 $num = $db->num_rows($result);
325 $i = 0;
326 while ($i < $num) {
327 $obj = $db->fetch_object($result);
328 array_push($permsuser, $obj->fk_id);
329 $i++;
330 }
331 $db->free($result);
332} else {
334}
335
336// Read the permissions of a user inherited by its groups
337$permsgroupbyentity = array();
338
339$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group
340$sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
341$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user
342$sql .= " WHERE gr.entity = ".((int) $entity); // it's very important, don't change please !
343// The entity on the table gu=usergroup_user should be useless and should never be used because it is already into gr and r.
344// but when using MULTICOMPANY_TRANSVERSE_MODE, we may have inserted record that make rubbish result here due to the duplicate record of
345// other entities, so we are forced to add a filter on gu here
346if (getDolGlobalString("MULTICOMPANY_TRANSVERSE_MODE_FIX_WHEN_GU_CONTAINS_0")) {
347 $sql .= " AND gu.entity IN (0,". ((int) $entity).")";
348} else {
349 $sql .= " AND gu.entity = ".((int) $entity);
350}
351$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
352$sql .= " AND gu.fk_user = ".((int) $object->id);
353
354dol_syslog("get user perms", LOG_DEBUG);
355$result = $db->query($sql);
356if ($result) {
357 $num = $db->num_rows($result);
358 $i = 0;
359 while ($i < $num) {
360 $obj = $db->fetch_object($result);
361 if (!isset($permsgroupbyentity[$obj->entity])) {
362 $permsgroupbyentity[$obj->entity] = array();
363 }
364 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
365 $i++;
366 }
367 $db->free($result);
368} else {
370}
371
372
373
374/*
375 * Part to add/remove permissions
376 */
377
378$linkback = '';
379
380if ($user->hasRight("user", "user", "read") || $user->admin) {
381 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
382}
383
384$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid valignmiddle" rel="noopener">';
385$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard', 'class="valignmiddle marginleftonly paddingrightonly"');
386$morehtmlref .= '</a>';
387
388$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
389$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="refid valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'refid valignmiddle nohover');
390
391dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
392
393
394print '<div class="fichecenter">';
395
396print '<div class="underbanner clearboth"></div>';
397print '<table class="border centpercent tableforfield">';
398
399// Login
400print '<tr><td id="anchorforperms" class="titlefield">'.$langs->trans("Login").'</td>';
401if (!empty($object->ldap_sid) && $object->status == 0) {
402 print '<td class="error">';
403 print $langs->trans("LoginAccountDisableInDolibarr");
404 print '</td>';
405} else {
406 print '<td>';
407 $addadmin = '';
408 if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
409 $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "superadmin", 'class="paddingleft valignmiddle"');
410 } elseif (!empty($object->admin)) {
411 $addadmin .= img_picto($langs->trans("AdministratorDesc"), "admin", 'class="paddingleft valignmiddle"');
412 }
413 print showValueWithClipboardCPButton($object->login).$addadmin;
414 print '</td>';
415}
416print '</tr>'."\n";
417
418// Type
419print '<tr><td>';
420$text = $langs->trans("Type");
421print $form->textwithpicto($text, $langs->trans("InternalExternalDesc"));
422print '</td><td>';
423$type = $langs->trans("Internal");
424if ($object->socid > 0) {
425 $type = $langs->trans("External");
426}
427print '<span class="badgeneutral">';
428print $type;
429if ($object->ldap_sid) {
430 print ' ('.$langs->trans("DomainUser").')';
431}
432print '</span>';
433print '</td></tr>'."\n";
434
435print '</table>';
436print '</div>';
437
438
439print '<br>';
440
441
442if ($user->admin) {
443 $s = $langs->trans("WarningOnlyPermissionOfActivatedModules")." ".$langs->trans("YouCanEnableModulesFrom");
444 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
445 $s .= '<br>';
446 $s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
447 $s .= $langs->trans("YouAreUsingTheAdvancedPermissionsMode");
448 } else {
449 $s .= '<br>';
450 $s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
451 $s .= $langs->trans("YouAreUsingTheSimplePermissionsMode");
452 }
453 print info_admin($s);
454}
455// If edited user is an extern user, we show warning for external users
456if (!empty($object->socid)) {
457 print info_admin(showModulesExludedForExternal($modules))."\n";
458}
459print '<br>';
460
461$parameters = array('permsgroupbyentity' => $permsgroupbyentity);
462$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
463if ($reshook < 0) {
464 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
465}
466
467print "\n";
468print '<div class="div-table-responsive-no-min">';
469print '<table class="noborder centpercent">';
470
471print '<tr class="liste_titre">';
472print '<td>'.$langs->trans("Module").'</td>';
473if ($caneditperms) {
474 print '<td class="center nowrap">';
475 print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'module' => 'allmodules', 'confirm' => 'yes'], true).'">'.$langs->trans("All")."</a>";
476 print ' / ';
477 print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'module' => 'allmodules', 'confirm' => 'yes'], true).'">'.$langs->trans("None")."</a>";
478 print '</td>';
479} else {
480 print '<td></td>';
481}
482print '<td></td>';
483print '<td class="right nowrap" colspan="2">';
484print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
485print ' | ';
486print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
487print '</td>';
488print '</tr>'."\n";
489
490// Get list of all permissions
491$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
492$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
493$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
494$sql .= " AND r.entity = ".((int) $entity);
495if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
496 $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
497}
498$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
499
500$familyinfo = array(
501 'hr' => array('position' => '001', 'label' => $langs->trans("ModuleFamilyHr")),
502 'crm' => array('position' => '006', 'label' => $langs->trans("ModuleFamilyCrm")),
503 'srm' => array('position' => '007', 'label' => $langs->trans("ModuleFamilySrm")),
504 'financial' => array('position' => '009', 'label' => $langs->trans("ModuleFamilyFinancial")),
505 'products' => array('position' => '012', 'label' => $langs->trans("ModuleFamilyProducts")),
506 'projects' => array('position' => '015', 'label' => $langs->trans("ModuleFamilyProjects")),
507 'ecm' => array('position' => '018', 'label' => $langs->trans("ModuleFamilyECM")),
508 'technic' => array('position' => '021', 'label' => $langs->trans("ModuleFamilyTechnic")),
509 'portal' => array('position' => '040', 'label' => $langs->trans("ModuleFamilyPortal")),
510 'interface' => array('position' => '050', 'label' => $langs->trans("ModuleFamilyInterface")),
511 'base' => array('position' => '060', 'label' => $langs->trans("ModuleFamilyBase")),
512 'other' => array('position' => '100', 'label' => $langs->trans("ModuleFamilyOther")),
513 'external' => array('position' => '500', 'label' => 'External'),
514);
515
516$arrayofpermission = array();
517$cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
518$cookietohidegrouparray = explode(',', $cookietohidegroup);
519
520$result = $db->query($sql);
521if ($result) {
522 $num = $db->num_rows($result);
523 $i = 0;
524
525 //var_dump($cookietohidegrouparray);
526
527 while ($i < $num) {
528 $obj = $db->fetch_object($result);
529
530 if (empty($obj->family)) {
531 $obj->family = 'other';
532 }
533 if (!empty($obj->family) && !isset($familyinfo[$obj->family])) {
534 $obj->family = 'external';
535 }
536
537 // Si la famille n'existe pas dans $familyinfo, on utilise 'other'
538 if (!empty($obj->family) && !isset($familyinfo[$obj->family])) {
539 $obj->family = 'other';
540 }
541 if (empty($obj->family_position)) {
542 $obj->family_position = $familyinfo[$obj->family]['position'];
543 if ($obj->module_position < 100000) {
544 $obj->module_position = intval($obj->module_position) + 100000;
545 } else {
546 $obj->module_position = intval($obj->module_position);
547 }
548 }
549
550 $obj->position = $obj->family_position.'_'.$obj->module_position.'_'.$obj->id;
551
552 $arrayofpermission[$i] = $obj;
553 $i++;
554 }
555} else {
557}
558
559
560$arrayofpermission = dol_sort_array($arrayofpermission, 'position');
561
562$j = 0;
563$oldmod = '';
564
565foreach ($arrayofpermission as $i => $obj) {
566 // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
567 if (empty($modules[$obj->module])) {
568 $i++;
569 continue;
570 }
571
572 // Special cases
573 if (isModEnabled("reception")) {
574 // The 2 permission in fournisseur modules has been replaced by permissions into reception module
575 if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
576 $i++;
577 continue;
578 }
579 if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
580 $i++;
581 continue;
582 }
583 }
584
585 $objMod = $modules[$obj->module];
586
587 if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
588 $ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
589 } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
590 $ishidden = 1;
591 } else {
592 $ishidden = 0;
593 }
594 $isexpanded = ! $ishidden;
595 //var_dump("isexpanded=".$isexpanded);
596
597 $permsgroupbyentitypluszero = array();
598 if (!empty($permsgroupbyentity[0])) {
599 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
600 }
601 if (!empty($permsgroupbyentity[$entity])) {
602 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
603 }
604 //var_dump($permsgroupbyentitypluszero);
605
606 // Break found, it's a new module to catch
607 if (isset($obj->module) && ($oldmod != $obj->module)) {
608 $oldmod = $obj->module;
609
610 $j++;
611 if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
612 $ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
613 } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
614 $ishidden = 1;
615 } else {
616 $ishidden = 0;
617 }
618 $isexpanded = ! $ishidden;
619 //var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
620
621 // Break detected, we get objMod
622 $objMod = $modules[$obj->module];
623 $picto = ($objMod->picto ? $objMod->picto : 'generic');
624
625 // Show break line
626 print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
627 // Picto and label of module
628 print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
629 print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
630 print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
631 print '<a name="'.$objMod->getName().'"></a>';
632 print '</td>';
633
634 // Permission and tick (2 columns)
635 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
636 if ($caneditperms) {
637 print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
638 print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
639 print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("All")."</a>";
640 print ' / ';
641 print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'module' => $obj->module, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">'.$langs->trans("None")."</a>";
642 print '</span>';
643 print '</td>';
644 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
645 print '</td>';
646 } else {
647 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
648 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
649 }
650 } else {
651 if ($caneditperms) {
652 print '<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
653 /*print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
654 print ' / ';
655 print '<a class="reposition alink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
656 */
657 print '</td>';
658 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
659 print '</td>';
660 } else {
661 print '<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
662 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
663 }
664 }
665
666 // Description of permission (2 columns)
667 print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
668 print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
669
670 print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
671 print img_picto('', 'folder', 'class="marginright"');
672 print '</div>';
673 print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
674 print img_picto('', 'folder-open', 'class="marginright"');
675 print '</div>';
676
677 print '</td>'; //Add picto + / - when open en closed
678 print '</tr>'."\n";
679 }
680
681 $permlabel = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && ($langs->trans("PermissionAdvanced".$obj->id) != "PermissionAdvanced".$obj->id) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != "Permission".$obj->id) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
682
683 print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
684 print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
685
686 // Picto and label of module
687 print '<td class="maxwidthonsmartphone">';
688 print '</td>';
689
690 // Permission and tick (2 columns)
691 if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
692 print '<!-- perm is a perm allowed to any admin -->';
693 if ($caneditperms) {
694 print '<td class="center nowrap">';
695 print img_picto($langs->trans("AdministratorDesc"), 'admin', 'class="paddingleft valignmiddle"');
696 print '</td>';
697 } else {
698 print '<td class="center nowrap">';
699 print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
700 print '</td>';
701 }
702 print '<td>';
703 print '</td>';
704 } elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
705 print '<!-- user has perm -->';
706 if ($caneditperms) {
707 print '<td class="center nowrap">';
708 print '<a class="reposition addexpandedmodulesinparamlist" id="'.$obj->id.'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
709 //print img_edit_remove($langs->trans("Remove"));
710 print img_picto($langs->trans("Remove"), 'switch_on');
711 print '</a>';
712 print '</td>';
713 } else {
714 print '<td class="center nowrap">';
715 print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
716 print '</td>';
717 }
718 print '<td>';
719 print '</td>';
720 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
721 print '<!-- permsgroupbyentitypluszero -->';
722 if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
723 print '<td class="center nowrap">';
724 print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
725 //print img_picto($langs->trans("Active"), 'tick');
726 print '</td>';
727 print '<td class="center nowrap">';
728 print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
729 print '</td>';
730 } else {
731 // Do not own permission
732 if ($caneditperms) {
733 print '<td class="center nowrap">';
734 print '<a class="reposition addexpandedmodulesinparamlist" id="'.$obj->id.'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
735 //print img_edit_add($langs->trans("Add"));
736 print img_picto($langs->trans("Add"), 'switch_off');
737 print '</a>';
738 print '</td>';
739 } else {
740 print '<td class="center nowrap">';
741 print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
742 print '</td>';
743 }
744 print '<td>';
745 print '</td>';
746 }
747 } else {
748 // Do not own permission
749 print '<!-- do not own permission -->';
750 if ($caneditperms) {
751 print '<td class="center nowrap">';
752 print '<a class="reposition addexpandedmodulesinparamlist" id="'.$obj->id.'" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
753 //print img_edit_add($langs->trans("Add"));
754 print img_picto($langs->trans("Add"), 'switch_off');
755 print '</a>';
756 print '</td>';
757 } else {
758 print '<td class="center nowrap">';
759 print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
760 print '</td>';
761 }
762 print '<td>';
763 print '</td>';
764 }
765
766 // Description of permission (1 or 2 columns)
767 if (!$user->admin) {
768 print '<td colspan="2">';
769 } else {
770 print '<td>';
771 }
772
773 print $permlabel;
774 $idtouse = $obj->id;
775 if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
776 $idtouse = 122;
777 }
778 if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
779 print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
780 }
781 if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
782 print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
783 }
784 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
785 if (preg_match('/_advance$/', $obj->perms)) {
786 print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
787 }
788 }
789 // Special warning case for the permission "Allow to modify other users password"
790 if ($obj->module == 'user' && $obj->perms == 'user' && $obj->subperms == 'password') {
791 if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
792 in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
793 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
794 print ' '.img_warning($langs->trans("AllowPasswordResetBySendingANewPassByEmail"));
795 }
796 }
797 // Special warning case for the permission "Create/modify other users, groups and permissions"
798 if ($obj->module == 'user' && $obj->perms == 'user' && ($obj->subperms == 'creer' || $obj->subperms == 'create')) {
799 if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
800 in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
801 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
802 print ' '.img_warning($langs->trans("AllowAnyPrivileges"));
803 }
804 }
805 // Special case for reading bank account when you have permission to manage Chart of account
806 if ($obj->module == 'banque' && $obj->perms == 'lire') {
807 if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) {
808 print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission"));
809 }
810 }
811
812 print '</td>';
813
814 // Permission id
815 if ($user->admin) {
816 print '<td class="right">';
817 $htmltext = $langs->trans("ID").': '.$obj->id;
818 $htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
819 print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
820 //print '<span class="opacitymedium">'.$obj->id.'</span>';
821 print '</td>';
822 }
823
824 print '</tr>'."\n";
825
826 $i++;
827}
828print '</table>';
829print '</div>';
830
831print '<script>';
832print '$(".tdforbreakperms:not(.alink)").on("click", function(){
833 console.log("Click on tdforbreakperms");
834 moduletohide = $(this).data("hide-perms");
835 j = $(this).data("j");
836 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
837 console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines");
838 $(".trtohide_"+moduletohide).show();
839 $(".permtoshow_"+moduletohide).hide();
840 $(".permtohide_"+moduletohide).show();
841 $(".folderperms_"+moduletohide).hide();
842 $(".folderopenperms_"+moduletohide).show();
843 $("#idforbreakperms_"+moduletohide).val("0");
844 } else if (! $(this).hasClass("tdforbreakpermsifnotempty")) {
845 console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines");
846 $(".trtohide_"+moduletohide).hide();
847 $(".folderopenperms_"+moduletohide).hide();
848 $(".folderperms_"+moduletohide).show();
849 $(".permtoshow_"+moduletohide).show();
850 $(".permtohide_"+moduletohide).hide();
851 $("#idforbreakperms_"+moduletohide).val("1");
852 }
853
854 // Now rebuild the value for cookie
855 var hideuserperm="";
856 $(".trforbreakperms").each(function(index) {
857 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
858 if ($("input[data-j="+(index+1)+"]").val() == 1) {
859 hideuserperm=hideuserperm+","+(index+1);
860 }
861 });
862 // set cookie by js
863 date = new Date(); date.setTime(date.getTime()+(30*86400000));
864 if (hideuserperm) {
865 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
866 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
867 } else {
868 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
869 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
870 }
871});';
872print "\n";
873
874// Button expand / collapse all
875print '$(".showallperms").on("click", function(){
876 console.log("Click on showallperms");
877
878 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
879 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
880 $(".tdforbreakperms").each( function(){
881 moduletohide = $(this).data("hide-perms");
882 //console.log(moduletohide);
883 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
884 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
885 }
886 })
887});
888
889$(".hideallperms").on("click", function(){
890 console.log("Click on hideallperms");
891
892 $(".tdforbreakperms").each( function(){
893 moduletohide = $(this).data("hide-perms");
894 //console.log(moduletohide);
895 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
896 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
897 }
898 })
899});';
900print "\n";
901print '</script>';
902
903print '<style>';
904print '.switchfolderperms{
905 cursor: pointer;
906}';
907print '</style>';
908
909$parameters = array();
910$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
911if ($reshook < 0) {
912 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
913}
914
915
916print dol_get_fiche_end();
917
918// End of page
919llxFooter();
920$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
showModulesExludedForExternal($modules)
Show array with constants to edit.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.