31if (!defined(
'CSRFCHECK_WITH_TOKEN')) {
32 define(
'CSRFCHECK_WITH_TOKEN',
'1');
36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
50$langs->loadLangs(array(
'users',
'admin'));
53$action =
GETPOST(
'action',
'aZ09');
54$confirm =
GETPOST(
'confirm',
'alpha');
55$module =
GETPOST(
'module',
'alpha');
57$updatedmodulename =
GETPOST(
'updatedmodulename',
'alpha');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userperms';
60if (!isset($id) || empty($id)) {
65$canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
67$caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
70 $canreaduser = ($user->admin || ($user->hasRight(
"user",
"user",
"read") && $user->hasRight(
"user",
"user_advance",
"readperms")));
71 $caneditselfperms = ($user->id ==
$id && $user->hasRight(
"user",
"self_advance",
"writeperms"));
72 $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
77if (!empty($user->socid) && $user->socid > 0) {
78 $socid = $user->socid;
80$feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
82if ($user->id == $id && (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
"user",
"self_advance",
"readperms") && empty($user->admin))) {
87$hookmanager->initHooks(array(
'usercard',
'userperms',
'globalcard'));
89$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
90if ($user->id != $id && !$canreaduser) {
98$entity =
$conf->entity;
104$parameters = array(
'socid' => $socid);
105$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
110if (empty($reshook)) {
111 if ($action ==
'addrights' && $caneditperms && $confirm ==
'yes') {
112 $edituser =
new User($db);
114 $result = $edituser->addrights($rights, $module,
'', $entity);
120 if (
$object->id == $user->id) {
121 $user->clearrights();
124 $menumanager->loadMenu();
131 if ($action ==
'delrights' && $caneditperms && $confirm ==
'yes') {
132 $edituser =
new User($db);
134 $result = $edituser->delrights($rights, $module,
'', $entity);
140 if (
$object->id == $user->id) {
141 $user->clearrights();
144 $menumanager->loadMenu();
157$form =
new Form($db);
160$title = $person_name.
" - ".$langs->trans(
'Permissions');
162llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card_perms');
166$title = $langs->trans(
"User");
176foreach ($modulesdir as $dir) {
178 if (is_resource($handle)) {
179 while (($file = readdir($handle)) !==
false) {
180 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
181 $modName = substr($file, 0,
dol_strlen($file) - 10);
184 include_once $dir.$file;
185 $objMod =
new $modName($db);
186 '@phan-var-force DolibarrModules $objMod';
189 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
190 foreach ($objMod->langfiles as $domain) {
191 $langs->load($domain);
195 if ($objMod->rights_class) {
196 $ret = $objMod->insert_permissions(0, $entity);
197 $modules[$objMod->rights_class] = $objMod;
208'@phan-var-force DolibarrModules[] $modules';
213$sql =
"SELECT DISTINCT ur.fk_id";
214$sql .=
" FROM ".MAIN_DB_PREFIX.
"user_rights as ur";
215$sql .=
" WHERE ur.entity = ".((int) $entity);
216$sql .=
" AND ur.fk_user = ".((int)
$object->id);
219$result = $db->query($sql);
221 $num = $db->num_rows($result);
224 $obj = $db->fetch_object($result);
225 array_push($permsuser, $obj->fk_id);
234$permsgroupbyentity = array();
236$sql =
"SELECT DISTINCT gr.fk_id, gu.entity";
237$sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup_rights as gr,";
238$sql .=
" ".MAIN_DB_PREFIX.
"usergroup_user as gu";
239$sql .=
" WHERE gr.entity = ".((int) $entity);
244 $sql .=
" AND gu.entity IN (0,". ((int) $entity).
")";
246 $sql .=
" AND gu.entity = ".((int) $entity);
248$sql .=
" AND gr.fk_usergroup = gu.fk_usergroup";
249$sql .=
" AND gu.fk_user = ".((int)
$object->id);
252$result = $db->query($sql);
254 $num = $db->num_rows($result);
257 $obj = $db->fetch_object($result);
258 if (!isset($permsgroupbyentity[$obj->entity])) {
259 $permsgroupbyentity[$obj->entity] = array();
261 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
277if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
278 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
281$morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener">';
282$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
283$morehtmlref .=
'</a>';
285$urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
286$morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
288dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
291print
'<div class="fichecenter">';
293print
'<div class="underbanner clearboth"></div>';
294print
'<table class="border centpercent tableforfield">';
297print
'<tr><td id="anchorforperms" class="titlefield">'.$langs->trans(
"Login").
'</td>';
299 print
'<td class="error">';
300 print $langs->trans(
"LoginAccountDisableInDolibarr");
305 if (property_exists(
$object,
'admin')) {
306 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
307 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
308 } elseif (!empty(
$object->admin)) {
309 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
319$text = $langs->trans(
"Type");
320print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
322$type = $langs->trans(
"Internal");
324 $type = $langs->trans(
"External");
326print
'<span class="badgeneutral">';
329 print
' ('.$langs->trans(
"DomainUser").
')';
332print
'</td></tr>'.
"\n";
341 print
info_admin($langs->trans(
"WarningOnlyPermissionOfActivatedModules").
" ".$langs->trans(
"YouCanEnableModulesFrom"));
349$parameters = array(
'permsgroupbyentity' => $permsgroupbyentity);
350$reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
356print
'<div class="div-table-responsive-no-min">';
357print
'<table class="noborder centpercent">';
359print
'<tr class="liste_titre">';
360print
'<td>'.$langs->trans(
"Module").
'</td>';
362 print
'<td class="center nowrap">';
363 print
'<a class="reposition commonlink addexpandedmodulesinparamlist" 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>";
365 print
'<a class="reposition commonlink addexpandedmodulesinparamlist" 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>";
371print
'<td class="right nowrap" colspan="2">';
372print
'<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>';
374print
'<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>';
381$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
382$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
383$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
384$sql .=
" AND r.entity = ".((int) $entity);
385$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
387$result = $db->query($sql);
389 $num = $db->num_rows($result);
394 $obj = $db->fetch_object($result);
397 if (!isset($obj->module) || empty($modules[$obj->module])) {
403 if (isModEnabled(
"reception")) {
405 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
409 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
415 $objMod = $modules[$obj->module];
418 if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $obj->module_position < 100000)) {
419 if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
424 $newmoduleposition = $modules[$obj->module]->module_position;
427 $objMod = $modules[$obj->module];
428 if (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $newmoduleposition < 100000) {
429 $newmoduleposition += 100000;
432 $sqlupdate =
'UPDATE '.MAIN_DB_PREFIX.
"rights_def SET module_position = ".((int) $newmoduleposition).
",";
433 $sqlupdate .=
" family_position = ".((int) $familyposition);
434 $sqlupdate .=
" WHERE module_position = ".((int) $obj->module_position).
" AND module = '".$db->escape($obj->module).
"'";
436 $db->query($sqlupdate);
445$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
446$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
447$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
448$sql .=
" AND r.entity = ".((int) $entity);
450 $sql .=
" AND r.perms NOT LIKE '%_advance'";
452$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
454$result = $db->query($sql);
456 $num = $db->num_rows($result);
461 $cookietohidegroup = (empty($_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]) ?
'' : preg_replace(
'/^,/',
'', $_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]));
462 $cookietohidegrouparray = explode(
',', $cookietohidegroup);
466 $obj = $db->fetch_object($result);
469 if (empty($modules[$obj->module])) {
475 if (isModEnabled(
"reception")) {
477 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
481 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
487 $objMod = $modules[$obj->module];
489 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
490 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
491 } elseif (in_array($j, $cookietohidegrouparray)) {
496 $isexpanded = ! $ishidden;
499 $permsgroupbyentitypluszero = array();
500 if (!empty($permsgroupbyentity[0])) {
501 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
503 if (!empty($permsgroupbyentity[$entity])) {
504 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
509 if (isset($obj->module) && ($oldmod != $obj->module)) {
510 $oldmod = $obj->module;
513 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
514 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
515 } elseif (in_array($j, $cookietohidegrouparray)) {
520 $isexpanded = ! $ishidden;
524 $objMod = $modules[$obj->module];
525 $picto = ($objMod->picto ? $objMod->picto :
'generic');
528 print
'<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.
'" data-j="'.$j.
'">';
530 print
'<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'" title="'.
dol_escape_htmltag($objMod->getName()).
'">';
531 print
'<input type="hidden" name="forbreakperms_'.$obj->module.
'" id="idforbreakperms_'.$obj->module.
'" css="cssforfieldishiden" data-j="'.$j.
'" value="'.($isexpanded ?
'0' :
"1").
'">';
532 print
img_object(
'', $picto,
'class="pictoobjectwidth paddingright"').
' '.$objMod->getName();
533 print
'<a name="'.$objMod->getName().
'"></a>';
537 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty(
$object->admin)) {
539 print
'<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
540 print
'<span class="permtohide_'.dol_escape_htmltag($obj->module).
'" '.(!$isexpanded ?
' style="display:none"' :
'').
'>';
541 print
'<a class="reposition alink addexpandedmodulesinparamlist" 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>";
543 print
'<a class="reposition alink addexpandedmodulesinparamlist" 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>";
546 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
549 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
550 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
554 print
'<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
560 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
563 print
'<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
564 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
569 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
570 print
'<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
572 print
'<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).
'"'.($isexpanded ?
' style="display:none;"' :
'').
'>';
573 print
img_picto(
'',
'folder',
'class="marginright"');
575 print
'<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).
'"'.(!$isexpanded ?
' style="display:none;"' :
'').
'>';
576 print
img_picto(
'',
'folder-open',
'class="marginright"');
583 $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)));
585 print
'<!-- '.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'').
' -->'.
"\n";
586 print
'<tr class="oddeven trtohide_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none"' :
'').
'>';
589 print
'<td class="maxwidthonsmartphone">';
593 if (!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) {
594 print
'<!-- perm is a perm allowed to any admin -->';
596 print
'<td class="center nowrap">';
597 print
img_picto($langs->trans(
"AdministratorDesc"),
'star',
'class="paddingleft valignmiddle"');
600 print
'<td class="center nowrap">';
601 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
606 } elseif (in_array($obj->id, $permsuser)) {
607 print
'<!-- user has perm -->';
609 print
'<td class="center nowrap">';
610 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delrights&token='.
newToken().
'&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&updatedmodulename='.$obj->module.
'">';
612 print
img_picto($langs->trans(
"Remove"),
'switch_on');
616 print
'<td class="center nowrap">';
617 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
622 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
623 print
'<!-- permsgroupbyentitypluszero -->';
624 if (in_array($obj->id, $permsgroupbyentitypluszero)) {
625 print
'<td class="center nowrap">';
626 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
629 print
'<td class="center nowrap">';
630 print $form->textwithtooltip($langs->trans(
"Inherited"), $langs->trans(
"PermissionInheritedFromAGroup"));
635 print
'<td class="center nowrap">';
636 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=addrights&token='.
newToken().
'&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&updatedmodulename='.$obj->module.
'">';
638 print
img_picto($langs->trans(
"Add"),
'switch_off');
642 print
'<td class="center nowrap">';
643 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
651 print
'<!-- do not own permission -->';
653 print
'<td class="center nowrap">';
654 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=addrights&token='.
newToken().
'&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&updatedmodulename='.$obj->module.
'">';
656 print
img_picto($langs->trans(
"Add"),
'switch_off');
660 print
'<td class="center nowrap">';
661 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
670 print
'<td colspan="2">';
677 if (in_array($idtouse, array(121, 122, 125, 126))) {
680 if ($langs->trans(
"Permission".$idtouse.
'b') !=
"Permission".$idtouse.
'b') {
681 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$idtouse.
'b').
'</span>';
683 if ($langs->trans(
"Permission".$obj->id.
'c') !=
"Permission".$obj->id.
'c') {
684 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$obj->id.
'c').
'</span>';
687 if (preg_match(
'/_advance$/', $obj->perms)) {
688 print
' <span class="opacitymedium">('.$langs->trans(
"AdvancedModeOnly").
')</span>';
692 if ($obj->module ==
'user' && $obj->perms ==
'user' && $obj->subperms ==
'password') {
693 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
694 in_array($obj->id, $permsuser) ||
695 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
696 print
' '.img_warning($langs->trans(
"AllowPasswordResetBySendingANewPassByEmail"));
700 if ($obj->module ==
'user' && $obj->perms ==
'user' && ($obj->subperms ==
'creer' || $obj->subperms ==
'create')) {
701 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
702 in_array($obj->id, $permsuser) ||
703 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
704 print
' '.img_warning($langs->trans(
"AllowAnyPrivileges"));
708 if ($obj->module ==
'banque' && $obj->perms ==
'lire') {
709 if (isModEnabled(
"accounting") &&
$object->hasRight(
'accounting',
'chartofaccount')) {
710 print
' '.img_warning($langs->trans(
"WarningReadBankAlsoAllowedIfUserHasPermission"));
718 print
'<td class="right">';
719 $htmltext = $langs->trans(
"ID").
': '.$obj->id;
720 $htmltext .=
'<br>'.$langs->trans(
"Permission").
': user->hasRight(\''.
dol_escape_htmltag($obj->module).
'\', \
''.dol_escape_htmltag($obj->perms).
'\''.($obj->subperms ?
', \''.dol_escape_htmltag($obj->subperms).
'\'' :
'').
')';
721 print $form->textwithpicto(
'', $htmltext, 1,
'help',
'inline-block marginrightonly');
737print
'$(".tdforbreakperms:not(.alink)").on("click", function(){
738 console.log("Click on tdforbreakperms");
739 moduletohide = $(this).data("hide-perms");
740 j = $(this).data("j");
741 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
742 console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines");
743 $(".trtohide_"+moduletohide).show();
744 $(".permtoshow_"+moduletohide).hide();
745 $(".permtohide_"+moduletohide).show();
746 $(".folderperms_"+moduletohide).hide();
747 $(".folderopenperms_"+moduletohide).show();
748 $("#idforbreakperms_"+moduletohide).val("0");
749 } else if (! $(this).hasClass("tdforbreakpermsifnotempty")) {
750 console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines");
751 $(".trtohide_"+moduletohide).hide();
752 $(".folderopenperms_"+moduletohide).hide();
753 $(".folderperms_"+moduletohide).show();
754 $(".permtoshow_"+moduletohide).show();
755 $(".permtohide_"+moduletohide).hide();
756 $("#idforbreakperms_"+moduletohide).val("1");
759 // Now rebuild the value for cookie
761 $(".trforbreakperms").each(function(index) {
762 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
763 if ($("input[data-j="+(index+1)+"]").val() == 1) {
764 hideuserperm=hideuserperm+","+(index+1);
768 date = new Date(); date.setTime(date.getTime()+(30*86400000));
770 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
771 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
773 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
774 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
780print
'$(".showallperms").on("click", function(){
781 console.log("Click on showallperms");
783 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
784 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
785 $(".tdforbreakperms").each( function(){
786 moduletohide = $(this).data("hide-perms");
787 //console.log(moduletohide);
788 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
789 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
794$(".hideallperms").on("click", function(){
795 console.log("Click on hideallperms");
797 $(".tdforbreakperms").each( function(){
798 moduletohide = $(this).data("hide-perms");
799 //console.log(moduletohide);
800 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
801 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
809print
'.switchfolderperms{
814$parameters = array();
815$reshook = $hookmanager->executeHooks(
'insertExtraFooter', $parameters,
$object, $action);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.