dolibarr  16.0.5
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  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
29 if (!defined('CSRFCHECK_WITH_TOKEN')) {
30  define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
31 }
32 
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
37 
38 // Load translation files required by page
39 $langs->loadLangs(array('users', 'admin'));
40 
41 $id = GETPOST('id', 'int');
42 $action = GETPOST('action', 'aZ09');
43 $confirm = GETPOST('confirm', 'alpha');
44 $module = GETPOST('module', 'alpha');
45 $rights = GETPOST('rights', 'int');
46 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search
47 
48 if (!isset($id) || empty($id)) {
50 }
51 
52 // Define if user can read permissions
53 $canreaduser = ($user->admin || $user->rights->user->user->lire);
54 // Define if user can modify other users and permissions
55 $caneditperms = ($user->admin || $user->rights->user->user->creer);
56 // Advanced permissions
57 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
58  $canreaduser = ($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
59  $caneditselfperms = ($user->id == $id && $user->rights->user->self_advance->writeperms);
60  $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
61 }
62 
63 // Security check
64 $socid = 0;
65 if (isset($user->socid) && $user->socid > 0) {
66  $socid = $user->socid;
67 }
68 $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
69 // A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin
70 if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) {
72 }
73 
74 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
75 if ($user->id <> $id && !$canreaduser) {
77 }
78 
79 $object = new User($db);
80 $object->fetch($id, '', '', 1);
81 $object->getrights();
82 
83 $entity = $conf->entity;
84 
85 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
86 $hookmanager->initHooks(array('usercard', 'userperms', 'globalcard'));
87 
88 
89 /*
90  * Actions
91  */
92 
93 $parameters = array('socid'=>$socid);
94 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
95 if ($reshook < 0) {
96  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
97 }
98 
99 if (empty($reshook)) {
100  if ($action == 'addrights' && $caneditperms && $confirm == 'yes') {
101  $edituser = new User($db);
102  $edituser->fetch($object->id);
103  $result = $edituser->addrights($rights, $module, '', $entity);
104  if ($result < 0) {
105  setEventMessages($edituser->error, $edituser->errors, 'errors');
106  }
107 
108  // If we are changing our own permissions, we reload permissions and menu
109  if ($object->id == $user->id) {
110  $user->clearrights();
111  $user->getrights();
112  $menumanager->loadMenu();
113  }
114 
115  $object->clearrights();
116  $object->getrights();
117  }
118 
119  if ($action == 'delrights' && $caneditperms && $confirm == 'yes') {
120  $edituser = new User($db);
121  $edituser->fetch($object->id);
122  $result = $edituser->delrights($rights, $module, '', $entity);
123  if ($result < 0) {
124  setEventMessages($edituser->error, $edituser->errors, 'errors');
125  }
126 
127  // If we are changing our own permissions, we reload permissions and menu
128  if ($object->id == $user->id) {
129  $user->clearrights();
130  $user->getrights();
131  $menumanager->loadMenu();
132  }
133 
134  $object->clearrights();
135  $object->getrights();
136  }
137 }
138 
139 
140 /*
141  * View
142  */
143 
144 $form = new Form($db);
145 
146 llxHeader('', $langs->trans("Permissions"));
147 
148 $head = user_prepare_head($object);
149 
150 $title = $langs->trans("User");
151 print dol_get_fiche_head($head, 'rights', $title, -1, 'user');
152 
153 
154 $db->begin();
155 
156 // Search all modules with permission and reload permissions def.
157 $modules = array();
158 $modulesdir = dolGetModulesDirs();
159 
160 foreach ($modulesdir as $dir) {
161  $handle = @opendir(dol_osencode($dir));
162  if (is_resource($handle)) {
163  while (($file = readdir($handle)) !== false) {
164  if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
165  $modName = substr($file, 0, dol_strlen($file) - 10);
166 
167  if ($modName) {
168  include_once $dir.$file;
169  $objMod = new $modName($db);
170 
171  // Load all lang files of module
172  if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
173  foreach ($objMod->langfiles as $domain) {
174  $langs->load($domain);
175  }
176  }
177  // Load all permissions
178  if ($objMod->rights_class) {
179  $ret = $objMod->insert_permissions(0, $entity);
180  $modules[$objMod->rights_class] = $objMod;
181  //print "modules[".$objMod->rights_class."]=$objMod;";
182  }
183  }
184  }
185  }
186  }
187 }
188 
189 $db->commit();
190 
191 // Read permissions of user
192 $permsuser = array();
193 
194 $sql = "SELECT DISTINCT ur.fk_id";
195 $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
196 $sql .= " WHERE ur.entity = ".((int) $entity);
197 $sql .= " AND ur.fk_user = ".((int) $object->id);
198 
199 dol_syslog("get user perms", LOG_DEBUG);
200 $result = $db->query($sql);
201 if ($result) {
202  $num = $db->num_rows($result);
203  $i = 0;
204  while ($i < $num) {
205  $obj = $db->fetch_object($result);
206  array_push($permsuser, $obj->fk_id);
207  $i++;
208  }
209  $db->free($result);
210 } else {
211  dol_print_error($db);
212 }
213 
214 // Lecture des droits groupes
215 $permsgroupbyentity = array();
216 
217 $sql = "SELECT DISTINCT gr.fk_id, gu.entity";
218 $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
219 $sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu";
220 $sql .= " WHERE gr.entity = ".((int) $entity);
221 $sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
222 $sql .= " AND gu.fk_user = ".((int) $object->id);
223 
224 dol_syslog("get user perms", LOG_DEBUG);
225 $result = $db->query($sql);
226 if ($result) {
227  $num = $db->num_rows($result);
228  $i = 0;
229  while ($i < $num) {
230  $obj = $db->fetch_object($result);
231  if (!isset($permsgroupbyentity[$obj->entity])) {
232  $permsgroupbyentity[$obj->entity] = array();
233  }
234  array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
235  $i++;
236  }
237  $db->free($result);
238 } else {
239  dol_print_error($db);
240 }
241 
242 
243 /*
244  * Part to add/remove permissions
245  */
246 
247 $linkback = '';
248 
249 if ($user->rights->user->user->lire || $user->admin) {
250  $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
251 }
252 
253 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
254 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
255 $morehtmlref .= '</a>';
256 
257 dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
258 
259 
260 print '<div class="fichecenter">';
261 
262 print '<div class="underbanner clearboth"></div>';
263 print '<table class="border centpercent tableforfield">';
264 
265 // Login
266 print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
267 if (!empty($object->ldap_sid) && $object->statut == 0) {
268  print '<td class="error">';
269  print $langs->trans("LoginAccountDisableInDolibarr");
270  print '</td>';
271 } else {
272  print '<td>';
273  $addadmin = '';
274  if (property_exists($object, 'admin')) {
275  if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
276  $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
277  } elseif (!empty($object->admin)) {
278  $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
279  }
280  }
281  print showValueWithClipboardCPButton($object->login).$addadmin;
282  print '</td>';
283 }
284 print '</tr>'."\n";
285 
286 print '</table>';
287 
288 print '</div>';
289 print '<br>';
290 
291 if ($user->admin) {
292  print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
293 }
294 // If edited user is an extern user, we show warning for external users
295 if (! empty($object->socid)) {
296  print info_admin(showModulesExludedForExternal($modules))."\n";
297 }
298 
299 $parameters = array('permsgroupbyentity'=>$permsgroupbyentity);
300 $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
301 if ($reshook < 0) {
302  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
303 }
304 
305 
306 print "\n";
307 print '<div class="div-table-responsive-no-min">';
308 print '<table class="noborder centpercent">';
309 
310 print '<tr class="liste_titre">';
311 print '<td>'.$langs->trans("Module").'</td>';
312 if ($caneditperms) {
313  print '<td class="center nowrap">';
314  print '<a class="reposition commonlink" 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=allmodules&confirm=yes">'.$langs->trans("All")."</a>";
315  print ' / ';
316  print '<a class="reposition commonlink" 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=allmodules&confirm=yes">'.$langs->trans("None")."</a>";
317  print '</td>';
318 }
319 print '<td class="center" width="24">&nbsp;</td>';
320 print '<td>'.$langs->trans("Permissions").'</td>';
321 if ($user->admin) {
322  print '<td class="right"></td>';
323 }
324 print '</tr>'."\n";
325 
326 
327 // Fix bad value for module_position in table
328 // ------------------------------------------
329 $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
330 $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
331 $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
332 $sql .= " AND r.entity = ".((int) $entity);
333 $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
334 
335 $result = $db->query($sql);
336 if ($result) {
337  $num = $db->num_rows($result);
338  $i = 0;
339  $oldmod = '';
340 
341  while ($i < $num) {
342  $obj = $db->fetch_object($result);
343 
344  // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
345  if (!isset($obj->module) || empty($modules[$obj->module])) {
346  $i++;
347  continue;
348  }
349 
350  // Special cases
351  if (!empty($conf->reception->enabled)) {
352  // The 2 permissions in fournisseur modules are replaced by permissions into reception module
353  if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
354  $i++;
355  continue;
356  }
357  if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
358  $i++;
359  continue;
360  }
361  }
362 
363  $objMod = $modules[$obj->module];
364 
365  // Save field module_position in database if value is wrong
366  if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $obj->module_position < 100000)) {
367  if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
368  // TODO Define familyposition
369  //$familyposition = $modules[$obj->module]->family_position;
370  $familyposition = 0;
371 
372  $newmoduleposition = $modules[$obj->module]->module_position;
373 
374  // Correct $newmoduleposition position for external modules
375  $objMod = $modules[$obj->module];
376  if (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $newmoduleposition < 100000) {
377  $newmoduleposition += 100000;
378  }
379 
380  $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".((int) $newmoduleposition).",";
381  $sqlupdate .= " family_position = ".((int) $familyposition);
382  $sqlupdate .= " WHERE module_position = ".((int) $obj->module_position)." AND module = '".$db->escape($obj->module)."'";
383 
384  $db->query($sqlupdate);
385  }
386  }
387  }
388 }
389 
390 
391 
392 //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
393 $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
394 $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
395 $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
396 $sql .= " AND r.entity = ".((int) $entity);
397 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
398  $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
399 }
400 $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
401 
402 $result = $db->query($sql);
403 if ($result) {
404  $num = $db->num_rows($result);
405  $i = 0;
406  $oldmod = '';
407 
408  while ($i < $num) {
409  $obj = $db->fetch_object($result);
410 
411  // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
412  if (empty($modules[$obj->module])) {
413  $i++;
414  continue;
415  }
416 
417  // Special cases
418  if (!empty($conf->reception->enabled)) {
419  // The 2 permission in fournisseur modules has been replaced by permissions into reception module
420  if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
421  $i++;
422  continue;
423  }
424  if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
425  $i++;
426  continue;
427  }
428  }
429 
430  $objMod = $modules[$obj->module];
431 
432  // Save field module_position in database if value is wrong
433  /*
434  if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $obj->module_position < 100000)) {
435  if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
436  // TODO Define familyposition
437  //$familyposition = $modules[$obj->module]->family_position;
438  $familyposition = 0;
439 
440  $newmoduleposition = $modules[$obj->module]->module_position;
441 
442  // Correct $newmoduleposition position for external modules
443  $objMod = $modules[$obj->module];
444  if (is_object($objMod) && $objMod->isCoreOrExternalModule() == 'external' && $newmoduleposition < 100000) {
445  $newmoduleposition += 100000;
446  }
447 
448  $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".((int) $newmoduleposition).",";
449  $sqlupdate .= " family_position = ".((int) $familyposition);
450  $sqlupdate .= " WHERE module_position = ".((int) $obj->module_position)." AND module = '".$db->escape($obj->module)."'";
451 
452  $db->query($sqlupdate);
453  }
454  }
455  */
456 
457  // Break found, it's a new module to catch
458  if (isset($obj->module) && ($oldmod <> $obj->module)) {
459  $oldmod = $obj->module;
460 
461  // Break detected, we get objMod
462  $objMod = $modules[$obj->module];
463  $picto = ($objMod->picto ? $objMod->picto : 'generic');
464 
465  // Show break line
466  print '<tr class="oddeven trforbreak">';
467  print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
468  print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
469  print '<a name="'.$objMod->getName().'"></a>';
470  print '</td>';
471  if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
472  if ($caneditperms) {
473  print '<td class="center nowrap">';
474  print '<a class="reposition" 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">'.$langs->trans("All")."</a>";
475  print ' / ';
476  print '<a class="reposition" 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">'.$langs->trans("None")."</a>";
477  print '</td>';
478  }
479  print '<td>&nbsp;</td>';
480  } else {
481  if ($caneditperms) {
482  print '<td>&nbsp;</td>';
483  }
484  print '<td>&nbsp;</td>';
485  }
486  print '<td>&nbsp;</td>';
487 
488  // Permission id
489  if ($user->admin) {
490  print '<td class="right"></td>';
491  }
492 
493  print '</tr>'."\n";
494  }
495 
496  print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
497  print '<tr class="oddeven">';
498 
499  // Picto and label of module
500  print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
501  //print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
502  print '</td>';
503 
504  // Permission and tick
505  if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
506  if ($caneditperms) {
507  print '<td class="center">'.img_picto($langs->trans("Administrator"), 'star').'</td>';
508  }
509  print '<td class="center nowrap">';
510  print img_picto($langs->trans("Active"), 'tick');
511  print '</td>';
512  } elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
513  if ($caneditperms) {
514  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes">';
515  //print img_edit_remove($langs->trans("Remove"));
516  print img_picto($langs->trans("Remove"), 'switch_on');
517  print '</a></td>';
518  }
519  print '<td class="center nowrap">';
520  print img_picto($langs->trans("Active"), 'tick');
521  print '</td>';
522  } elseif (isset($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
523  if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Permission granted by group
524  if ($caneditperms) {
525  print '<td class="center">';
526  print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
527  print '</td>';
528  }
529  print '<td class="center nowrap">';
530  print img_picto($langs->trans("Active"), 'tick');
531  print '</td>';
532  } else {
533  // Do not own permission
534  if ($caneditperms) {
535  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
536  //print img_edit_add($langs->trans("Add"));
537  print img_picto($langs->trans("Add"), 'switch_off');
538  print '</a></td>';
539  }
540  print '<td>&nbsp;</td>';
541  }
542  } else {
543  // Do not own permission
544  if ($caneditperms) {
545  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
546  //print img_edit_add($langs->trans("Add"));
547  print img_picto($langs->trans("Add"), 'switch_off');
548  print '</a></td>';
549  }
550  print '<td>&nbsp;</td>';
551  }
552 
553  // Description of permission
554  $permlabel = (!empty($conf->global->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)));
555  print '<td>';
556  print $permlabel;
557  if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
558  if (preg_match('/_advance$/', $obj->perms)) {
559  print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
560  }
561  }
562  print '</td>';
563 
564  // Permission id
565  if ($user->admin) {
566  print '<td class="right">';
567  $htmltext = $langs->trans("ID").': '.$obj->id;
568  $htmltext .= '<br>'.$langs->trans("Permission").': user->rights->'.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '');
569  print $form->textwithpicto('', $htmltext);
570  //print '<span class="opacitymedium">'.$obj->id.'</span>';
571  print '</td>';
572  }
573 
574  print '</tr>'."\n";
575 
576  $i++;
577  }
578 } else {
579  dol_print_error($db);
580 }
581 print '</table>';
582 print '</div>';
583 
584 $parameters = array();
585 $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
586 if ($reshook < 0) {
587  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
588 }
589 
590 
591 print dol_get_fiche_end();
592 
593 // End of page
594 llxFooter();
595 $db->close();
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
dol_osencode
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
Definition: functions.lib.php:8499
user_prepare_head
user_prepare_head(User $object)
Prepare array with list of tabs.
Definition: usergroups.lib.php:35
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2046
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
$parameters
$parameters
Actions.
Definition: perms.php:84
showValueWithClipboardCPButton
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
Definition: functions.lib.php:11087
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
dolGetModulesDirs
dolGetModulesDirs($subdir='')
Return list of modules directories.
Definition: functions2.lib.php:80
User
Class to manage Dolibarr users.
Definition: user.class.php:44
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4211
showModulesExludedForExternal
showModulesExludedForExternal($modules)
Show array with constants to edit.
Definition: admin.lib.php:1822
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59