32if (!defined(
'CSRFCHECK_WITH_TOKEN')) {
33 define(
'CSRFCHECK_WITH_TOKEN',
'1');
37require
'../main.inc.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
51$langs->loadLangs(array(
'users',
'admin'));
54$action =
GETPOST(
'action',
'aZ09');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$module =
GETPOST(
'module',
'alpha');
58$updatedmodulename =
GETPOST(
'updatedmodulename',
'alpha');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userperms';
61if (!isset($id) || empty($id)) {
66$canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
68$caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
71 $canreaduser = ($user->admin || ($user->hasRight(
"user",
"user",
"read") && $user->hasRight(
"user",
"user_advance",
"readperms")));
72 $caneditselfperms = ($user->id ==
$id && $user->hasRight(
"user",
"self_advance",
"writeperms"));
73 $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
78if (!empty($user->socid) && $user->socid > 0) {
79 $socid = $user->socid;
81$feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
83if ($user->id == $id && (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
"user",
"self_advance",
"readperms") && empty($user->admin))) {
88$hookmanager->initHooks(array(
'usercard',
'userperms',
'globalcard'));
90$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
91if ($user->id != $id && !$canreaduser) {
99$entity = $conf->entity;
106$parameters = array(
'socid' => $socid);
107$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
112if (empty($reshook)) {
113 if ($action ==
'addrights' && $caneditperms && $confirm ==
'yes') {
114 $edituser =
new User($db);
116 $result = $edituser->addrights($rights, $module,
'', $entity);
122 if (
$object->id == $user->id) {
123 $user->clearrights();
126 $menumanager->loadMenu();
133 $qs = $_SERVER[
"QUERY_STRING"];
134 $qs = preg_replace(
'/&action=addrights/',
'', $qs);
135 $qs = preg_replace(
'/&token=[0-9a-f]+/i',
'', $qs);
136 $qs = preg_replace(
'/&confirm=yes/',
'', $qs);
138 header(
"Location: ".$_SERVER[
"PHP_SELF"].($qs ?
"?".$qs :
""));
142 if ($action ==
'delrights' && $caneditperms && $confirm ==
'yes') {
143 $edituser =
new User($db);
145 $result = $edituser->delrights($rights, $module,
'', $entity);
151 if (
$object->id == $user->id) {
152 $user->clearrights();
155 $menumanager->loadMenu();
162 $qs = $_SERVER[
"QUERY_STRING"];
163 $qs = preg_replace(
'/&action=delrights/',
'', $qs);
164 $qs = preg_replace(
'/&token=[0-9a-f]+/i',
'', $qs);
165 $qs = preg_replace(
'/&confirm=yes/',
'', $qs);
166 header(
"Location: ".$_SERVER[
"PHP_SELF"].($qs ?
"?".$qs :
""));
177foreach ($modulesdir as $dir) {
179 if (is_resource($handle)) {
180 while (($file = readdir($handle)) !==
false) {
181 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
182 $modName = substr($file, 0,
dol_strlen($file) - 10);
185 include_once $dir.$file;
186 $objMod =
new $modName($db);
187 '@phan-var-force DolibarrModules $objMod';
191 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
192 foreach ($objMod->langfiles as $domain) {
193 $langs->load($domain);
197 if ($objMod->rights_class) {
198 $objMod->insert_permissions(0, $entity);
199 $modules[$objMod->rights_class] = $objMod;
210'@phan-var-force DolibarrModules[] $modules';
215$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.family, r.family_position, r.bydefault";
216$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
217$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
218$sql .=
" AND r.entity = ".((int) $entity);
219$sql .=
" ORDER BY r.family, r.family_position, r.module_position, r.module, r.id";
221$result = $db->query($sql);
223 $num = $db->num_rows($result);
227 $obj = $db->fetch_object($result);
230 if (!isset($obj->module) || empty($modules[$obj->module])) {
238 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
242 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
248 $objMod = $modules[$obj->module];
252 if (empty($obj->module_position) || ($objMod->isCoreOrExternalModule() ==
'external' && $obj->module_position < 100000)) {
253 if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
258 $newmoduleposition = $modules[$obj->module]->module_position;
261 $objMod = $modules[$obj->module];
262 if (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $newmoduleposition < 100000) {
263 $newmoduleposition += 100000;
266 $sqlupdate =
'UPDATE '.MAIN_DB_PREFIX.
"rights_def SET module_position = ".((int) $newmoduleposition).
",";
267 $sqlupdate .=
" family_position = ".((int) $familyposition);
268 $sqlupdate .=
" WHERE module_position = ".((int) $obj->module_position).
" AND module = '".$db->escape($obj->module).
"'";
270 $db->query($sqlupdate);
275 if (empty($obj->family) && !empty($objMod->family)) {
276 $newfamily = $objMod->family;
277 $sqlupdate =
'UPDATE '.MAIN_DB_PREFIX.
"rights_def SET family = '".$db->escape($newfamily).
"'";
278 $sqlupdate .=
" WHERE id = ".((int) $obj->id);
280 $db->query($sqlupdate);
292$form =
new Form($db);
295$title = $person_name.
" - ".$langs->trans(
'Permissions');
297llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card_perms');
301$title = $langs->trans(
"User");
307$sql =
"SELECT ur.fk_id";
308$sql .=
" FROM ".MAIN_DB_PREFIX.
"user_rights as ur";
309$sql .=
" WHERE ur.entity = ".((int) $entity);
310$sql .=
" AND ur.fk_user = ".((int)
$object->id);
313$result = $db->query($sql);
315 $num = $db->num_rows($result);
318 $obj = $db->fetch_object($result);
319 array_push($permsuser, $obj->fk_id);
328$permsgroupbyentity = array();
330$sql =
"SELECT DISTINCT gr.fk_id, gu.entity";
331$sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup_rights as gr,";
332$sql .=
" ".MAIN_DB_PREFIX.
"usergroup_user as gu";
333$sql .=
" WHERE gr.entity = ".((int) $entity);
338 $sql .=
" AND gu.entity IN (0,". ((int) $entity).
")";
340 $sql .=
" AND gu.entity = ".((int) $entity);
342$sql .=
" AND gr.fk_usergroup = gu.fk_usergroup";
343$sql .=
" AND gu.fk_user = ".((int)
$object->id);
346$result = $db->query($sql);
348 $num = $db->num_rows($result);
351 $obj = $db->fetch_object($result);
352 if (!isset($permsgroupbyentity[$obj->entity])) {
353 $permsgroupbyentity[$obj->entity] = array();
355 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
371if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
372 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
375$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">';
376$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
377$morehtmlref .=
'</a>';
379$urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
380$morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="refid valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
382dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
385print
'<div class="fichecenter">';
387print
'<div class="underbanner clearboth"></div>';
388print
'<table class="border centpercent tableforfield">';
391print
'<tr><td id="anchorforperms" class="titlefield">'.$langs->trans(
"Login").
'</td>';
393 print
'<td class="error">';
394 print $langs->trans(
"LoginAccountDisableInDolibarr");
400 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
401 } elseif (!empty(
$object->admin)) {
402 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
411$text = $langs->trans(
"Type");
412print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
414$type = $langs->trans(
"Internal");
416 $type = $langs->trans(
"External");
418print
'<span class="badgeneutral">';
421 print
' ('.$langs->trans(
"DomainUser").
')';
424print
'</td></tr>'.
"\n";
434 $s = $langs->trans(
"WarningOnlyPermissionOfActivatedModules").
" ".$langs->trans(
"YouCanEnableModulesFrom");
437 $s .=
img_picto($langs->trans(
'InfoAdmin'),
'info-circle').
' ';
438 $s .= $langs->trans(
"YouAreUsingTheAdvancedPermissionsMode");
441 $s .=
img_picto($langs->trans(
'InfoAdmin'),
'info-circle').
' ';
442 $s .= $langs->trans(
"YouAreUsingTheSimplePermissionsMode");
452$parameters = array(
'permsgroupbyentity' => $permsgroupbyentity);
453$reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
459print
'<div class="div-table-responsive-no-min">';
460print
'<table class="noborder centpercent">';
462print
'<tr class="liste_titre">';
463print
'<td>'.$langs->trans(
"Module").
'</td>';
465 print
'<td class="center nowrap">';
466 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>";
468 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>";
474print
'<td class="right nowrap" colspan="2">';
475print
'<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>';
477print
'<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>';
482$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
483$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
484$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
485$sql .=
" AND r.entity = ".((int) $entity);
487 $sql .=
" AND r.perms NOT LIKE '%_advance'";
489$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
492 'hr' => array(
'position' =>
'001',
'label' => $langs->trans(
"ModuleFamilyHr")),
493 'crm' => array(
'position' =>
'006',
'label' => $langs->trans(
"ModuleFamilyCrm")),
494 'srm' => array(
'position' =>
'007',
'label' => $langs->trans(
"ModuleFamilySrm")),
495 'financial' => array(
'position' =>
'009',
'label' => $langs->trans(
"ModuleFamilyFinancial")),
496 'products' => array(
'position' =>
'012',
'label' => $langs->trans(
"ModuleFamilyProducts")),
497 'projects' => array(
'position' =>
'015',
'label' => $langs->trans(
"ModuleFamilyProjects")),
498 'ecm' => array(
'position' =>
'018',
'label' => $langs->trans(
"ModuleFamilyECM")),
499 'technic' => array(
'position' =>
'021',
'label' => $langs->trans(
"ModuleFamilyTechnic")),
500 'portal' => array(
'position' =>
'040',
'label' => $langs->trans(
"ModuleFamilyPortal")),
501 'interface' => array(
'position' =>
'050',
'label' => $langs->trans(
"ModuleFamilyInterface")),
502 'base' => array(
'position' =>
'060',
'label' => $langs->trans(
"ModuleFamilyBase")),
503 'other' => array(
'position' =>
'100',
'label' => $langs->trans(
"ModuleFamilyOther")),
504 'external' => array(
'position' =>
'500',
'label' =>
'External'),
507$arrayofpermission = array();
508$cookietohidegroup = (empty($_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]) ?
'' : preg_replace(
'/^,/',
'', $_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]));
509$cookietohidegrouparray = explode(
',', $cookietohidegroup);
511$result = $db->query($sql);
513 $num = $db->num_rows($result);
519 $obj = $db->fetch_object($result);
521 if (empty($obj->family)) {
522 $obj->family =
'other';
524 if (!empty($obj->family) && !isset($familyinfo[$obj->family])) {
525 $obj->family =
'external';
528 if (empty($obj->family_position)) {
529 $obj->family_position = $familyinfo[$obj->family][
'position'];
530 if ($obj->module_position < 100000) {
531 $obj->module_position = intval($obj->module_position) + 100000;
533 $obj->module_position = intval($obj->module_position);
537 $obj->position = $obj->family_position.
'_'.$obj->module_position.
'_'.$obj->id;
539 $arrayofpermission[$i] = $obj;
547$arrayofpermission =
dol_sort_array($arrayofpermission,
'position');
552foreach ($arrayofpermission as $i => $obj) {
554 if (empty($modules[$obj->module])) {
562 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
566 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
572 $objMod = $modules[$obj->module];
574 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
575 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
576 } elseif (in_array($j, $cookietohidegrouparray)) {
581 $isexpanded = ! $ishidden;
584 $permsgroupbyentitypluszero = array();
585 if (!empty($permsgroupbyentity[0])) {
586 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
588 if (!empty($permsgroupbyentity[$entity])) {
589 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
594 if (isset($obj->module) && ($oldmod != $obj->module)) {
595 $oldmod = $obj->module;
598 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
599 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
600 } elseif (in_array($j, $cookietohidegrouparray)) {
605 $isexpanded = ! $ishidden;
609 $objMod = $modules[$obj->module];
610 $picto = ($objMod->picto ? $objMod->picto :
'generic');
613 print
'<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.
'" data-j="'.$j.
'">';
615 print
'<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'" title="'.
dol_escape_htmltag($objMod->getName()).
'">';
616 print
'<input type="hidden" name="forbreakperms_'.$obj->module.
'" id="idforbreakperms_'.$obj->module.
'" css="cssforfieldishiden" data-j="'.$j.
'" value="'.($isexpanded ?
'0' :
"1").
'">';
617 print
img_object(
'', $picto,
'class="pictoobjectwidth paddingright"').
' '.$objMod->getName();
618 print
'<a name="'.$objMod->getName().
'"></a>';
622 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty(
$object->admin)) {
624 print
'<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
625 print
'<span class="permtohide_'.dol_escape_htmltag($obj->module).
'" '.(!$isexpanded ?
' style="display:none"' :
'').
'>';
626 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>";
628 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>";
631 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
634 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
635 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
639 print
'<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
645 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
648 print
'<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
649 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
654 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
655 print
'<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
657 print
'<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).
'"'.($isexpanded ?
' style="display:none;"' :
'').
'>';
658 print
img_picto(
'',
'folder',
'class="marginright"');
660 print
'<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).
'"'.(!$isexpanded ?
' style="display:none;"' :
'').
'>';
661 print
img_picto(
'',
'folder-open',
'class="marginright"');
668 $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)));
670 print
'<!-- '.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'').
' -->'.
"\n";
671 print
'<tr class="oddeven trtohide_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none"' :
'').
'>';
674 print
'<td class="maxwidthonsmartphone">';
678 if (!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) {
679 print
'<!-- perm is a perm allowed to any admin -->';
681 print
'<td class="center nowrap">';
682 print
img_picto($langs->trans(
"AdministratorDesc"),
'admin',
'class="paddingleft valignmiddle"');
685 print
'<td class="center nowrap">';
686 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
691 } elseif (in_array($obj->id, $permsuser)) {
692 print
'<!-- user has perm -->';
694 print
'<td class="center nowrap">';
695 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).
'">';
697 print
img_picto($langs->trans(
"Remove"),
'switch_on');
701 print
'<td class="center nowrap">';
702 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
707 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
708 print
'<!-- permsgroupbyentitypluszero -->';
709 if (in_array($obj->id, $permsgroupbyentitypluszero)) {
710 print
'<td class="center nowrap">';
711 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
714 print
'<td class="center nowrap">';
715 print $form->textwithtooltip($langs->trans(
"Inherited"), $langs->trans(
"PermissionInheritedFromAGroup"));
720 print
'<td class="center nowrap">';
721 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).
'">';
723 print
img_picto($langs->trans(
"Add"),
'switch_off');
727 print
'<td class="center nowrap">';
728 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
736 print
'<!-- do not own permission -->';
738 print
'<td class="center nowrap">';
739 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).
'">';
741 print
img_picto($langs->trans(
"Add"),
'switch_off');
745 print
'<td class="center nowrap">';
746 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
755 print
'<td colspan="2">';
762 if (in_array($idtouse, array(121, 122, 125, 126))) {
765 if ($langs->trans(
"Permission".$idtouse.
'b') !=
"Permission".$idtouse.
'b') {
766 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$idtouse.
'b').
'</span>';
768 if ($langs->trans(
"Permission".$obj->id.
'c') !=
"Permission".$obj->id.
'c') {
769 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$obj->id.
'c').
'</span>';
772 if (preg_match(
'/_advance$/', $obj->perms)) {
773 print
' <span class="opacitymedium">('.$langs->trans(
"AdvancedModeOnly").
')</span>';
777 if ($obj->module ==
'user' && $obj->perms ==
'user' && $obj->subperms ==
'password') {
778 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
779 in_array($obj->id, $permsuser) ||
780 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
781 print
' '.img_warning($langs->trans(
"AllowPasswordResetBySendingANewPassByEmail"));
785 if ($obj->module ==
'user' && $obj->perms ==
'user' && ($obj->subperms ==
'creer' || $obj->subperms ==
'create')) {
786 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
787 in_array($obj->id, $permsuser) ||
788 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
789 print
' '.img_warning($langs->trans(
"AllowAnyPrivileges"));
793 if ($obj->module ==
'banque' && $obj->perms ==
'lire') {
795 print
' '.img_warning($langs->trans(
"WarningReadBankAlsoAllowedIfUserHasPermission"));
803 print
'<td class="right">';
804 $htmltext = $langs->trans(
"ID").
': '.$obj->id;
805 $htmltext .=
'<br>'.$langs->trans(
"Permission").
': user->hasRight(\''.
dol_escape_htmltag($obj->module).
'\', \
''.dol_escape_htmltag($obj->perms).
'\''.($obj->subperms ?
', \''.dol_escape_htmltag($obj->subperms).
'\'' :
'').
')';
806 print $form->textwithpicto(
'', $htmltext, 1,
'help',
'inline-block marginrightonly');
819print
'$(".tdforbreakperms:not(.alink)").on("click", function(){
820 console.log("Click on tdforbreakperms");
821 moduletohide = $(this).data("hide-perms");
822 j = $(this).data("j");
823 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
824 console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines");
825 $(".trtohide_"+moduletohide).show();
826 $(".permtoshow_"+moduletohide).hide();
827 $(".permtohide_"+moduletohide).show();
828 $(".folderperms_"+moduletohide).hide();
829 $(".folderopenperms_"+moduletohide).show();
830 $("#idforbreakperms_"+moduletohide).val("0");
831 } else if (! $(this).hasClass("tdforbreakpermsifnotempty")) {
832 console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines");
833 $(".trtohide_"+moduletohide).hide();
834 $(".folderopenperms_"+moduletohide).hide();
835 $(".folderperms_"+moduletohide).show();
836 $(".permtoshow_"+moduletohide).show();
837 $(".permtohide_"+moduletohide).hide();
838 $("#idforbreakperms_"+moduletohide).val("1");
841 // Now rebuild the value for cookie
843 $(".trforbreakperms").each(function(index) {
844 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
845 if ($("input[data-j="+(index+1)+"]").val() == 1) {
846 hideuserperm=hideuserperm+","+(index+1);
850 date = new Date(); date.setTime(date.getTime()+(30*86400000));
852 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
853 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
855 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
856 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
862print
'$(".showallperms").on("click", function(){
863 console.log("Click on showallperms");
865 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
866 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
867 $(".tdforbreakperms").each( function(){
868 moduletohide = $(this).data("hide-perms");
869 //console.log(moduletohide);
870 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
871 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
876$(".hideallperms").on("click", function(){
877 console.log("Click on hideallperms");
879 $(".tdforbreakperms").each( function(){
880 moduletohide = $(this).data("hide-perms");
881 //console.log(moduletohide);
882 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
883 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
891print
'.switchfolderperms{
896$parameters = array();
897$reshook = $hookmanager->executeHooks(
'insertExtraFooter', $parameters,
$object, $action);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
showModulesExludedForExternal($modules)
Show array with constants to edit.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage Dolibarr users.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
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.
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.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.