33if (!defined(
'CSRFCHECK_WITH_TOKEN')) {
34 define(
'CSRFCHECK_WITH_TOKEN',
'1');
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';
52$langs->loadLangs(array(
'users',
'admin'));
55$action =
GETPOST(
'action',
'aZ09');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$module =
GETPOST(
'module',
'alpha');
59$updatedmodulename =
GETPOST(
'updatedmodulename',
'alpha');
60$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userperms';
62if (!isset($id) || empty($id)) {
67$canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
69$caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
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);
79if (!empty($user->socid) && $user->socid > 0) {
80 $socid = $user->socid;
82$feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
84if ($user->id == $id && (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
"user",
"self_advance",
"readperms") && empty($user->admin))) {
89$hookmanager->initHooks(array(
'usercard',
'userperms',
'globalcard'));
91$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
92if ($user->id != $id && !$canreaduser) {
100$entity =
$conf->entity;
107$parameters = array(
'socid' => $socid);
108$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
113if (empty($reshook)) {
114 if ($action ==
'addrights' && $caneditperms && $confirm ==
'yes') {
117 $result = $edituser->addrights($rights, $module,
'', $entity);
123 if (
$object->id == $user->id) {
124 $user->clearrights();
127 $menumanager->loadMenu();
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);
139 header(
"Location: ".$_SERVER[
"PHP_SELF"].($qs ?
"?".$qs :
""));
143 if ($action ==
'delrights' && $caneditperms && $confirm ==
'yes') {
146 $result = $edituser->delrights($rights, $module,
'', $entity);
152 if (
$object->id == $user->id) {
153 $user->clearrights();
156 $menumanager->loadMenu();
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 :
""));
179$excludedModules =
getDolGlobalInt(
'MAIN_USE_NEW_SUPPLIERMOD') ? array(
'modFournisseur') : array(
'modSupplierOrder',
'modSupplierInvoice');
181foreach ($modulesdir as $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);
190 if (in_array($modName, $excludedModules,
true)) {
194 include_once $dir.$file;
195 $objMod =
new $modName(
$db);
196 '@phan-var-force DolibarrModules $objMod';
200 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
201 foreach ($objMod->langfiles as $domain) {
202 $langs->load($domain);
206 if ($objMod->rights_class) {
207 $objMod->insert_permissions(0, $entity);
208 $modules[$objMod->rights_class] = $objMod;
219'@phan-var-force DolibarrModules[] $modules';
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%'";
227$sql .=
" AND r.entity = ".((int) $entity);
228$sql .=
" ORDER BY r.family, r.family_position, r.module_position, r.module, r.id";
230$result =
$db->query($sql);
232 $num =
$db->num_rows($result);
236 $obj =
$db->fetch_object($result);
239 if (!isset($obj->module) || empty($modules[$obj->module])) {
247 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
251 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
257 $objMod = $modules[$obj->module];
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)) {
267 $newmoduleposition = $modules[$obj->module]->module_position;
270 $objMod = $modules[$obj->module];
271 if (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $newmoduleposition < 100000) {
272 $newmoduleposition += 100000;
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).
"'";
279 $db->query($sqlupdate);
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);
289 $db->query($sqlupdate);
304$title = $person_name.
" - ".$langs->trans(
'Permissions');
306llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card_perms');
310$title = $langs->trans(
"User");
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);
322$result =
$db->query($sql);
324 $num =
$db->num_rows($result);
327 $obj =
$db->fetch_object($result);
328 array_push($permsuser, $obj->fk_id);
337$permsgroupbyentity = array();
339$sql =
"SELECT DISTINCT gr.fk_id, gu.entity";
340$sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup_rights as gr,";
341$sql .=
" ".MAIN_DB_PREFIX.
"usergroup_user as gu";
342$sql .=
" WHERE gr.entity = ".((int) $entity);
347 $sql .=
" AND gu.entity IN (0,". ((int) $entity).
")";
349 $sql .=
" AND gu.entity = ".((int) $entity);
351$sql .=
" AND gr.fk_usergroup = gu.fk_usergroup";
352$sql .=
" AND gu.fk_user = ".((int)
$object->id);
355$result =
$db->query($sql);
357 $num =
$db->num_rows($result);
360 $obj =
$db->fetch_object($result);
361 if (!isset($permsgroupbyentity[$obj->entity])) {
362 $permsgroupbyentity[$obj->entity] = array();
364 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
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>';
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>';
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');
391dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
394print
'<div class="fichecenter">';
396print
'<div class="underbanner clearboth"></div>';
397print
'<table class="border centpercent tableforfield">';
400print
'<tr><td id="anchorforperms" class="titlefield">'.$langs->trans(
"Login").
'</td>';
402 print
'<td class="error">';
403 print $langs->trans(
"LoginAccountDisableInDolibarr");
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"');
413 print showValueWithClipboardCPButton(
$object->login).$addadmin;
420$text = $langs->trans(
"Type");
421print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
423$type = $langs->trans(
"Internal");
425 $type = $langs->trans(
"External");
427print
'<span class="badgeneutral">';
430 print
' ('.$langs->trans(
"DomainUser").
')';
433print
'</td></tr>'.
"\n";
443 $s = $langs->trans(
"WarningOnlyPermissionOfActivatedModules").
" ".$langs->trans(
"YouCanEnableModulesFrom");
446 $s .=
img_picto($langs->trans(
'InfoAdmin'),
'info-circle').
' ';
447 $s .= $langs->trans(
"YouAreUsingTheAdvancedPermissionsMode");
450 $s .=
img_picto($langs->trans(
'InfoAdmin'),
'info-circle').
' ';
451 $s .= $langs->trans(
"YouAreUsingTheSimplePermissionsMode");
461$parameters = array(
'permsgroupbyentity' => $permsgroupbyentity);
462$reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
468print
'<div class="div-table-responsive-no-min">';
469print
'<table class="noborder centpercent">';
471print
'<tr class="liste_titre">';
472print
'<td>'.$langs->trans(
"Module").
'</td>';
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>";
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>";
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>';
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>';
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%'";
494$sql .=
" AND r.entity = ".((int) $entity);
496 $sql .=
" AND r.perms NOT LIKE '%_advance'";
498$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
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'),
516$arrayofpermission = array();
517$cookietohidegroup = (empty($_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]) ?
'' : preg_replace(
'/^,/',
'', $_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]));
518$cookietohidegrouparray = explode(
',', $cookietohidegroup);
520$result =
$db->query($sql);
522 $num =
$db->num_rows($result);
528 $obj =
$db->fetch_object($result);
530 if (empty($obj->family)) {
531 $obj->family =
'other';
533 if (!empty($obj->family) && !isset($familyinfo[$obj->family])) {
534 $obj->family =
'external';
538 if (!empty($obj->family) && !isset($familyinfo[$obj->family])) {
539 $obj->family =
'other';
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;
546 $obj->module_position = intval($obj->module_position);
550 $obj->position = $obj->family_position.
'_'.$obj->module_position.
'_'.$obj->id;
552 $arrayofpermission[$i] = $obj;
560$arrayofpermission =
dol_sort_array($arrayofpermission,
'position');
565foreach ($arrayofpermission as $i => $obj) {
567 if (empty($modules[$obj->module])) {
575 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
579 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
585 $objMod = $modules[$obj->module];
587 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
588 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
589 } elseif (in_array($j, $cookietohidegrouparray)) {
594 $isexpanded = ! $ishidden;
597 $permsgroupbyentitypluszero = array();
598 if (!empty($permsgroupbyentity[0])) {
599 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
601 if (!empty($permsgroupbyentity[$entity])) {
602 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
607 if (isset($obj->module) && ($oldmod != $obj->module)) {
608 $oldmod = $obj->module;
611 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
612 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
613 } elseif (in_array($j, $cookietohidegrouparray)) {
618 $isexpanded = ! $ishidden;
622 $objMod = $modules[$obj->module];
623 $picto = ($objMod->picto ? $objMod->picto :
'generic');
626 print
'<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.
'" data-j="'.$j.
'">';
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>';
635 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty(
$object->admin)) {
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>";
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>";
644 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
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>';
652 print
'<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
658 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
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>';
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).
'">';
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"');
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"');
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)));
683 print
'<!-- '.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'').
' -->'.
"\n";
684 print
'<tr class="oddeven trtohide_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none"' :
'').
'>';
687 print
'<td class="maxwidthonsmartphone">';
691 if (!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) {
692 print
'<!-- perm is a perm allowed to any admin -->';
694 print
'<td class="center nowrap">';
695 print
img_picto($langs->trans(
"AdministratorDesc"),
'admin',
'class="paddingleft valignmiddle"');
698 print
'<td class="center nowrap">';
699 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
704 } elseif (in_array($obj->id, $permsuser)) {
705 print
'<!-- user has perm -->';
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).
'">';
710 print
img_picto($langs->trans(
"Remove"),
'switch_on');
714 print
'<td class="center nowrap">';
715 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
720 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
721 print
'<!-- permsgroupbyentitypluszero -->';
722 if (in_array($obj->id, $permsgroupbyentitypluszero)) {
723 print
'<td class="center nowrap">';
724 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
727 print
'<td class="center nowrap">';
728 print $form->textwithtooltip($langs->trans(
"Inherited"), $langs->trans(
"PermissionInheritedFromAGroup"));
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).
'">';
736 print
img_picto($langs->trans(
"Add"),
'switch_off');
740 print
'<td class="center nowrap">';
741 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
749 print
'<!-- do not own permission -->';
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).
'">';
754 print
img_picto($langs->trans(
"Add"),
'switch_off');
758 print
'<td class="center nowrap">';
759 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
768 print
'<td colspan="2">';
775 if (in_array($idtouse, array(121, 122, 125, 126))) {
778 if ($langs->trans(
"Permission".$idtouse.
'b') !=
"Permission".$idtouse.
'b') {
779 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$idtouse.
'b').
'</span>';
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>';
785 if (preg_match(
'/_advance$/', $obj->perms)) {
786 print
' <span class="opacitymedium">('.$langs->trans(
"AdvancedModeOnly").
')</span>';
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) ||
793 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
794 print
' '.img_warning($langs->trans(
"AllowPasswordResetBySendingANewPassByEmail"));
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) ||
801 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
802 print
' '.img_warning($langs->trans(
"AllowAnyPrivileges"));
806 if ($obj->module ==
'banque' && $obj->perms ==
'lire') {
808 print
' '.img_warning($langs->trans(
"WarningReadBankAlsoAllowedIfUserHasPermission"));
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');
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");
854 // Now rebuild the value for cookie
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);
863 date = new Date(); date.setTime(date.getTime()+(30*86400000));
865 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
866 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
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=/ ";
875print
'$(".showallperms").on("click", function(){
876 console.log("Click on showallperms");
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
889$(".hideallperms").on("click", function(){
890 console.log("Click on hideallperms");
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
904print
'.switchfolderperms{
909$parameters = array();
910$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.
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.