feat: use all user perms if empty state (not if 0)

This commit is contained in:
yannis 2025-07-08 16:29:46 +02:00
parent cdb3021ce7
commit 16e84d0fa9

View file

@ -553,9 +553,6 @@ if ($action == 'create') {
$db->commit();
// Load perms ids for the user
$tokenperms = explode(",", $token->rights);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
@ -671,6 +668,13 @@ if ($action == 'create') {
dol_print_error($db);
}
// Load perms ids for the user
if (empty($token->rights) && !(strlen($token->rights) == 1 && substr($token->rights, 0, 1) == 0)) {
$tokenperms = $allusersperms;
} else {
$tokenperms = explode(",", $token->rights);
}
// Load and show all the perms grouped by module
if (count($allusersperms) > 0) {
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";