dolibarr 20.0.2
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) 2020 Tobias Sekan <tobias.sekan@startmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28if (!defined('CSRFCHECK_WITH_TOKEN')) {
29 define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
30}
31
32// Load Dolibarr environment
33require '../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
38
39// Load translation files required by page
40$langs->loadLangs(array('users', 'admin'));
41
42$id = GETPOSTINT('id');
43$action = GETPOST('action', 'aZ09');
44$confirm = GETPOST('confirm', 'alpha');
45$module = GETPOST('module', 'alpha');
46$rights = GETPOSTINT('rights');
47$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'groupperms'; // To manage different context of search
48
49if (!isset($id) || empty($id)) {
51}
52
53// Define if user can read permissions
54$canreadperms = ($user->admin || $user->hasRight("user", "user", "read"));
55// Define if user can modify group permissions
56$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
57// Advanced permissions
58$advancedpermsactive = false;
59if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
60 $advancedpermsactive = true;
61 $canreadperms = ($user->admin || ($user->hasRight("user", "group_advance", "read") && $user->hasRight("user", "group_advance", "readperms")));
62 $caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
63}
64
65// Security check
66$socid = 0;
67if (isset($user->socid) && $user->socid > 0) {
68 $socid = $user->socid;
69}
70//$result = restrictedArea($user, 'user', $id, 'usergroup', '');
71if (!$canreadperms) {
73}
74
75$object = new UserGroup($db);
76$object->fetch($id);
77$object->getrights();
78
79$entity = $conf->entity;
80
81// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
82$hookmanager->initHooks(array('groupperms', 'globalcard'));
83
84
85/*
86 * Actions
87 */
88
89$parameters = array('socid' => $socid);
90$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
91if ($reshook < 0) {
92 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
93}
94
95if (empty($reshook)) {
96 if ($action == 'addrights' && $caneditperms) {
97 $editgroup = new UserGroup($db);
98 $result = $editgroup->fetch($object->id);
99 if ($result > 0) {
100 $result = $editgroup->addrights($rights, $module, '', $entity);
101 if ($result < 0) {
102 setEventMessages($editgroup->error, $editgroup->errors, 'errors');
103 }
104 } else {
105 dol_print_error($db);
106 }
107
108 $user->clearrights();
109 $user->getrights();
110 }
111
112 if ($action == 'delrights' && $caneditperms) {
113 $editgroup = new UserGroup($db);
114 $result = $editgroup->fetch($id);
115 if ($result > 0) {
116 $result = $editgroup->delrights($rights, $module, '', $entity);
117 if ($result < 0) {
118 setEventMessages($editgroup->error, $editgroup->errors, 'errors');
119 }
120 } else {
121 dol_print_error($db);
122 }
123
124 $user->clearrights();
125 $user->getrights();
126 }
127}
128
129
130/*
131 * View
132 */
133
134$form = new Form($db);
135
136$title = $object->name." - ".$langs->trans('Permissions');
137$help_url = '';
138llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-group_perms');
139
140if ($object->id > 0) {
142 $title = $langs->trans("Group");
143 print dol_get_fiche_head($head, 'rights', $title, -1, 'group');
144
145 // Charge les modules soumis a permissions
146 $modules = array();
147 $modulesdir = dolGetModulesDirs();
148
149 $db->begin();
150
151 foreach ($modulesdir as $dir) {
152 $handle = @opendir(dol_osencode($dir));
153 if (is_resource($handle)) {
154 while (($file = readdir($handle)) !== false) {
155 if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
156 $modName = substr($file, 0, dol_strlen($file) - 10);
157
158 if ($modName) {
159 include_once $dir.$file;
160 $objMod = new $modName($db);
161 // Load all lang files of module
162 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
163 foreach ($objMod->langfiles as $domain) {
164 $langs->load($domain);
165 }
166 }
167 // Load all permissions
168 if ($objMod->rights_class) {
169 $ret = $objMod->insert_permissions(0, $entity);
170 $modules[$objMod->rights_class] = $objMod;
171 }
172 }
173 }
174 }
175 }
176 }
177
178 $db->commit();
179
180 // Read permissions of group
181 $permsgroupbyentity = array();
182
183 $sql = "SELECT DISTINCT r.id, r.libelle, r.module, gr.entity";
184 $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
185 $sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr";
186 $sql .= " WHERE gr.fk_id = r.id";
187 $sql .= " AND gr.entity = ".((int) $entity);
188 $sql .= " AND gr.fk_usergroup = ".((int) $object->id);
189
190 dol_syslog("get user perms", LOG_DEBUG);
191 $result = $db->query($sql);
192 if ($result) {
193 $num = $db->num_rows($result);
194 $i = 0;
195 while ($i < $num) {
196 $obj = $db->fetch_object($result);
197 if (!isset($permsgroupbyentity[$obj->entity])) {
198 $permsgroupbyentity[$obj->entity] = array();
199 }
200 array_push($permsgroupbyentity[$obj->entity], $obj->id);
201 $i++;
202 }
203 $db->free($result);
204 } else {
205 dol_print_error($db);
206 }
207
208 /*
209 * Part to add/remove permissions
210 */
211
212 $linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
213
214 dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
215
216 print '<div class="fichecenter">';
217
218 print '<div class="underbanner clearboth"></div>';
219 print '<table class="border centpercent tableforfield">';
220
221 // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
222 if (!empty($conf->mutlicompany->enabled)) {
223 print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
224 print '<td class="valeur">'.dol_escape_htmltag($object->name);
225 if (empty($object->entity)) {
226 print img_picto($langs->trans("GlobalGroup"), 'redstar');
227 }
228 print "</td></tr>\n";
229 }
230
231 // Multicompany
232 if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
233 $mc->getInfo($object->entity);
234 print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
235 print '<td class="valeur">'.dol_escape_htmltag($mc->label);
236 print "</td></tr>\n";
237 }
238
239 unset($object->fields['nom']); // Name already displayed in banner
240
241 // Common attributes
242 $keyforbreak = '';
243 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
244
245 // Other attributes
246 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
247
248 print '</table>';
249
250 print '</div>';
251
252 print '<div class="clearboth"></div>';
253
254 print '<br>';
255
256 if ($user->admin) {
257 print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
258 }
259
260 $parameters = array();
261 $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
262 if ($reshook < 0) {
263 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
264 }
265
266 print "\n";
267 print '<div class="div-table-responsive-no-min">';
268 print '<table class="noborder centpercent">';
269 print '<tr class="liste_titre">';
270 print '<td>'.$langs->trans("Module").'</td>';
271 if ($caneditperms) {
272 print '<td class="center nowrap">';
273 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>";
274 print '/';
275 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>";
276 print '</td>';
277 } else {
278 print '<td></td>';
279 }
280 print '<td class="center" width="24"></td>';
281 //print '<td>'.$langs->trans("Permissions").'</td>';
282 print '<td class="center"></td>';
283
284 print '<td class="right nowrap">';
285 print '<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>';
286 print ' | ';
287 print '<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>';
288 print '</td>';
289 print '</tr>'."\n";
290
291 $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
292 $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
293 $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
294 $sql .= " AND r.entity = ".((int) $entity);
295 if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
296 $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
297 }
298 $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
299
300 $result = $db->query($sql);
301 if ($result) {
302 $num = $db->num_rows($result);
303 $i = 0;
304 $j = 0;
305 $oldmod = '';
306
307 $cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
308 $cookietohidegrouparray = explode(',', $cookietohidegroup);
309
310 while ($i < $num) {
311 $obj = $db->fetch_object($result);
312
313 // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
314 if (empty($modules[$obj->module])) {
315 $i++;
316 continue;
317 }
318
319 $objMod = $modules[$obj->module];
320
321 if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
322 $ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
323 } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
324 $ishidden = 1;
325 } else {
326 $ishidden = 0;
327 }
328 $isexpanded = ! $ishidden;
329
330 // Break found, it's a new module to catch
331 if (isset($obj->module) && ($oldmod != $obj->module)) {
332 $oldmod = $obj->module;
333
334 $j++;
335 if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
336 $ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
337 } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
338 $ishidden = 1;
339 } else {
340 $ishidden = 0;
341 }
342 $isexpanded = ! $ishidden;
343 // Break detected, we get objMod
344 $objMod = $modules[$obj->module];
345 $picto = ($objMod->picto ? $objMod->picto : 'generic');
346
347 // Show break line
348 print '<tr class="oddeven trforbreakperms" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
349 // Picto and label of module
350 print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.$obj->module.'" title="'.dol_escape_htmltag($objMod->getName()).'">';
351 print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
352 print '<a name="'.$objMod->getName().'"></a>';
353 print '</td>';
354 // Permission and tick (2 columns)
355 if ($caneditperms) {
356 print '<td class="center wraponsmartphone">';
357 print '<span class="permtohide_'.$obj->module.'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
358 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>";
359 print ' / ';
360 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>";
361 print '</span>';
362 print '</td>';
363 print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'">';
364 print '</td>';
365 } else {
366 print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
367 print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
368 }
369 // Description of permission (2 columns)
370 print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
371 print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.$obj->module.'">';
372 print '<div class="switchfolderperms folderperms_'.$obj->module.'"'.($isexpanded ? ' style="display:none;"' : '').'>';
373 print img_picto('', 'folder', 'class="marginright"');
374 print '</div>';
375 print '<div class="switchfolderperms folderopenperms_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
376 print img_picto('', 'folder-open', 'class="marginright"');
377 print '</div>';
378 print '</td>'; //Add picto + / - when open en closed
379 print '</tr>'."\n";
380 }
381
382 print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
383 print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
384
385
386 // Picto and label of module
387 print '<td class="maxwidthonsmartphone tdoverflowmax200">';
388 print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
389 //print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
390 print '</td>';
391
392 // Permission and tick (2 columns)
393 if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
394 if (in_array($obj->id, $permsgroupbyentity[$entity])) {
395 // Own permission by group
396 if ($caneditperms) {
397 print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes">';
398 //print img_edit_remove($langs->trans("Remove"));
399 print img_picto($langs->trans("Remove"), 'switch_on');
400 print '</a></td>';
401 }
402 print '<td class="center nowrap">';
403 print img_picto($langs->trans("Active"), 'tick');
404 print '</td>';
405 } else {
406 // Do not own permission
407 if ($caneditperms) {
408 print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes">';
409 //print img_edit_add($langs->trans("Add"));
410 print img_picto($langs->trans("Add"), 'switch_off');
411 print '</a></td>';
412 }
413 print '<td>&nbsp;</td>';
414 }
415 } else {
416 // Do not own permission
417 if ($caneditperms) {
418 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().'">';
419 //print img_edit_add($langs->trans("Add"));
420 print img_picto($langs->trans("Add"), 'switch_off');
421 print '</a></td>';
422 } else {
423 print '<td>&nbsp;</td>';
424 }
425 print '<td>&nbsp;</td>';
426 }
427
428 // Description of permission (2 columns)
429 $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)));
430 print '<td>';
431 print $permlabel;
432 $idtouse = $obj->id;
433 if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
434 $idtouse = 122;
435 }
436 if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
437 print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
438 }
439 if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
440 print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
441 }
442 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
443 if (preg_match('/_advance$/', $obj->perms)) {
444 print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
445 }
446 }
447 print '</td>';
448
449 // Permission id
450 if ($user->admin) {
451 print '<td class="right">';
452 $htmltext = $langs->trans("ID").': '.$obj->id;
453 $htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')';
454 print $form->textwithpicto('', $htmltext);
455 //print '<span class="opacitymedium">'.$obj->id.'</span>';
456 print '</td>';
457 } else {
458 print '<td>&nbsp;</td>';
459 }
460
461 print '</tr>'."\n";
462
463 $i++;
464 }
465 }
466 print '</table>';
467 print '</div>';
468
469 print '<script>';
470 print '$(".tdforbreakperms:not(.alink)").on("click", function(){
471 console.log("Click on tdforbreakperms");
472 moduletohide = $(this).data("hide-perms");
473 j = $(this).data("j");
474 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
475 console.log("idforbreakperms_"+moduletohide+" has value hidden=1");
476 $(".trtohide_"+moduletohide).show();
477 $(".permtoshow_"+moduletohide).hide();
478 $(".permtohide_"+moduletohide).show();
479 $(".folderperms_"+moduletohide).hide();
480 $(".folderopenperms_"+moduletohide).show();
481 $("#idforbreakperms_"+moduletohide).val("0");
482 } else {
483 console.log("idforbreakperms_"+moduletohide+" has value hidden=0");
484 $(".trtohide_"+moduletohide).hide();
485 $(".folderopenperms_"+moduletohide).hide();
486 $(".folderperms_"+moduletohide).show();
487 $(".permtoshow_"+moduletohide).show();
488 $(".permtohide_"+moduletohide).hide();
489 $("#idforbreakperms_"+moduletohide).val("1");
490 }
491
492 // Now rebuild the value for cookie
493 var hideuserperm="";
494 $(".trforbreakperms").each(function(index) {
495 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
496 if ($("input[data-j="+(index+1)+"]").val() == 1) {
497 hideuserperm=hideuserperm+","+(index+1);
498 }
499 });
500 // set cookie by js
501 date = new Date(); date.setTime(date.getTime()+(30*86400000));
502 if (hideuserperm) {
503 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
504 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
505 } else {
506 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
507 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
508 }
509 });';
510
511 // Button expand / collapse all
512 print '$(".showallperms").on("click", function(){
513 console.log("Click on showallperms");
514
515 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
516 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
517 $(".tdforbreakperms").each( function(){
518 moduletohide = $(this).data("hide-perms");
519 //console.log(moduletohide);
520 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
521 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
522 }
523 })
524 });
525
526 $(".hideallperms").on("click", function(){
527 console.log("Click on hideallperms");
528
529 $(".tdforbreakperms").each( function(){
530 moduletohide = $(this).data("hide-perms");
531 //console.log(moduletohide);
532 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
533 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
534 }
535 })
536 });';
537 print "\n";
538 print '</script>';
539
540 print '<style>';
541 print '.switchfolderperms{
542 cursor: pointer;
543 }';
544 print '</style>';
545 print '</div>';
546
547 $parameters = array();
548 $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
549 if ($reshook < 0) {
550 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
551 }
552
553 print dol_get_fiche_end();
554}
555
556// End of page
557llxFooter();
558$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
Class to manage user groups.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
group_prepare_head($object)
Prepare array with list of tabs.