|
|
|
|
@@ -198,7 +198,7 @@ $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
|
|
|
|
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
|
|
|
|
|
$sql .= " AND r.entity = ".((int) $entity);
|
|
|
|
|
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
|
|
|
|
$sql .= " ORDER BY r.family, r.family_position, r.module_position, r.module, r.id";
|
|
|
|
|
|
|
|
|
|
$result = $db->query($sql);
|
|
|
|
|
if ($result) {
|
|
|
|
|
@@ -462,17 +462,32 @@ print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAl
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
|
|
|
|
|
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
|
|
|
|
|
// Get list of all permissions
|
|
|
|
|
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
|
|
|
|
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
|
|
|
|
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
|
|
|
|
|
$sql .= " AND r.entity = ".((int) $entity);
|
|
|
|
|
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
|
|
|
|
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
|
|
|
|
}
|
|
|
|
|
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
|
|
|
|
|
|
|
|
|
$familyinfo = array(
|
|
|
|
|
'hr' => array('position' => '001', 'label' => $langs->trans("ModuleFamilyHr")),
|
|
|
|
|
'crm' => array('position' => '006', 'label' => $langs->trans("ModuleFamilyCrm")),
|
|
|
|
|
'srm' => array('position' => '007', 'label' => $langs->trans("ModuleFamilySrm")),
|
|
|
|
|
'financial' => array('position' => '009', 'label' => $langs->trans("ModuleFamilyFinancial")),
|
|
|
|
|
'products' => array('position' => '012', 'label' => $langs->trans("ModuleFamilyProducts")),
|
|
|
|
|
'projects' => array('position' => '015', 'label' => $langs->trans("ModuleFamilyProjects")),
|
|
|
|
|
'ecm' => array('position' => '018', 'label' => $langs->trans("ModuleFamilyECM")),
|
|
|
|
|
'technic' => array('position' => '021', 'label' => $langs->trans("ModuleFamilyTechnic")),
|
|
|
|
|
'portal' => array('position' => '040', 'label' => $langs->trans("ModuleFamilyPortal")),
|
|
|
|
|
'interface' => array('position' => '050', 'label' => $langs->trans("ModuleFamilyInterface")),
|
|
|
|
|
'base' => array('position' => '060', 'label' => $langs->trans("ModuleFamilyBase")),
|
|
|
|
|
'other' => array('position' => '100', 'label' => $langs->trans("ModuleFamilyOther")),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = $db->query($sql);
|
|
|
|
|
if ($result) {
|
|
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
@@ -487,27 +502,78 @@ if ($result) {
|
|
|
|
|
while ($i < $num) {
|
|
|
|
|
$obj = $db->fetch_object($result);
|
|
|
|
|
|
|
|
|
|
if (empty($obj->family)) {
|
|
|
|
|
$obj->family = 'other';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (empty($obj->family_position)) {
|
|
|
|
|
$obj->family_position = $familyinfo[$obj->family]['position'];
|
|
|
|
|
if ($obj->module_position < 100000) {
|
|
|
|
|
$obj->module_position = intval($obj->module_position) + 100000;
|
|
|
|
|
} else {
|
|
|
|
|
$obj->module_position = intval($obj->module_position);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$obj->position = $obj->family_position.'_'.$obj->module_position.'_'.$obj->id;
|
|
|
|
|
|
|
|
|
|
$arrayofpermission[$i] = $obj;
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$arrayofpermission = dol_sort_array($arrayofpermission, 'position');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($arrayofpermission as $i => $obj) {
|
|
|
|
|
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
|
|
|
|
|
if (empty($modules[$obj->module])) {
|
|
|
|
|
if (empty($modules[$obj->module])) {
|
|
|
|
|
$i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Special cases
|
|
|
|
|
if (isModEnabled("reception")) {
|
|
|
|
|
// The 2 permission in fournisseur modules has been replaced by permissions into reception module
|
|
|
|
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
|
|
|
|
|
$i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Special cases
|
|
|
|
|
if (isModEnabled("reception")) {
|
|
|
|
|
// The 2 permission in fournisseur modules has been replaced by permissions into reception module
|
|
|
|
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
|
|
|
|
|
$i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
|
|
|
|
|
$i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
|
|
|
|
|
$i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$objMod = $modules[$obj->module];
|
|
|
|
|
|
|
|
|
|
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
|
|
|
|
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
|
|
|
|
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
|
|
|
|
$ishidden = 1;
|
|
|
|
|
} else {
|
|
|
|
|
$ishidden = 0;
|
|
|
|
|
}
|
|
|
|
|
$isexpanded = ! $ishidden;
|
|
|
|
|
//var_dump("isexpanded=".$isexpanded);
|
|
|
|
|
|
|
|
|
|
$permsgroupbyentitypluszero = array();
|
|
|
|
|
if (!empty($permsgroupbyentity[0])) {
|
|
|
|
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($permsgroupbyentity[$entity])) {
|
|
|
|
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
|
|
|
|
|
}
|
|
|
|
|
//var_dump($permsgroupbyentitypluszero);
|
|
|
|
|
|
|
|
|
|
// Break found, it's a new module to catch
|
|
|
|
|
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
|
|
|
|
$oldmod = $obj->module;
|
|
|
|
|
|
|
|
|
|
$j++;
|
|
|
|
|
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
|
|
|
|
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
|
|
|
|
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
|
|
|
|
@@ -516,92 +582,68 @@ if ($result) {
|
|
|
|
|
$ishidden = 0;
|
|
|
|
|
}
|
|
|
|
|
$isexpanded = ! $ishidden;
|
|
|
|
|
//var_dump("isexpanded=".$isexpanded);
|
|
|
|
|
//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
|
|
|
|
|
|
|
|
|
|
$permsgroupbyentitypluszero = array();
|
|
|
|
|
if (!empty($permsgroupbyentity[0])) {
|
|
|
|
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($permsgroupbyentity[$entity])) {
|
|
|
|
|
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
|
|
|
|
|
}
|
|
|
|
|
//var_dump($permsgroupbyentitypluszero);
|
|
|
|
|
// Break detected, we get objMod
|
|
|
|
|
$objMod = $modules[$obj->module];
|
|
|
|
|
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
|
|
|
|
|
|
|
|
|
// Break found, it's a new module to catch
|
|
|
|
|
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
|
|
|
|
$oldmod = $obj->module;
|
|
|
|
|
// Show break line
|
|
|
|
|
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
|
|
|
|
// Picto and label of module
|
|
|
|
|
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
|
|
|
|
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
|
|
|
|
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
|
|
|
|
print '<a name="'.$objMod->getName().'"></a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
$j++;
|
|
|
|
|
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
|
|
|
|
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
|
|
|
|
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
|
|
|
|
$ishidden = 1;
|
|
|
|
|
// Permission and tick (2 columns)
|
|
|
|
|
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
|
|
|
|
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>";
|
|
|
|
|
print ' / ';
|
|
|
|
|
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>";
|
|
|
|
|
print '</span>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
$ishidden = 0;
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
}
|
|
|
|
|
$isexpanded = ! $ishidden;
|
|
|
|
|
//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
|
|
|
|
|
|
|
|
|
|
// Break detected, we get objMod
|
|
|
|
|
$objMod = $modules[$obj->module];
|
|
|
|
|
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
|
|
|
|
|
|
|
|
|
// Show break line
|
|
|
|
|
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
|
|
|
|
// Picto and label of module
|
|
|
|
|
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
|
|
|
|
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
|
|
|
|
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
|
|
|
|
print '<a name="'.$objMod->getName().'"></a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Permission and tick (2 columns)
|
|
|
|
|
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
|
|
|
|
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>";
|
|
|
|
|
print ' / ';
|
|
|
|
|
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>";
|
|
|
|
|
print '</span>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
/*print '<a class="reposition alink" 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>";
|
|
|
|
|
print ' / ';
|
|
|
|
|
print '<a class="reposition alink" 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>";
|
|
|
|
|
*/
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="tdforbreakperms center wraponsmartphone" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
/*print '<a class="reposition alink" 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>";
|
|
|
|
|
print ' / ';
|
|
|
|
|
print '<a class="reposition alink" 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>";
|
|
|
|
|
*/
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Description of permission (2 columns)
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
|
|
|
|
|
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
|
|
|
|
print img_picto('', 'folder', 'class="marginright"');
|
|
|
|
|
print '</div>';
|
|
|
|
|
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
|
|
|
|
print img_picto('', 'folder-open', 'class="marginright"');
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '</td>'; //Add picto + / - when open en closed
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Description of permission (2 columns)
|
|
|
|
|
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
|
|
|
|
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
|
|
|
|
|
|
|
|
|
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
|
|
|
|
print img_picto('', 'folder', 'class="marginright"');
|
|
|
|
|
print '</div>';
|
|
|
|
|
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
|
|
|
|
print img_picto('', 'folder-open', 'class="marginright"');
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '</td>'; //Add picto + / - when open en closed
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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)));
|
|
|
|
|
|
|
|
|
|
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
|
|
|
|
|
@@ -612,65 +654,47 @@ if ($result) {
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Permission and tick (2 columns)
|
|
|
|
|
if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
|
|
|
|
|
print '<!-- perm is a perm allowed to any admin -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="paddingleft valignmiddle"');
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin
|
|
|
|
|
print '<!-- perm is a perm allowed to any admin -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="paddingleft valignmiddle"');
|
|
|
|
|
print '</td>';
|
|
|
|
|
} elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
|
|
|
|
|
print '<!-- user has perm -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
|
|
|
//print img_edit_remove($langs->trans("Remove"));
|
|
|
|
|
print img_picto($langs->trans("Remove"), 'switch_on');
|
|
|
|
|
print '</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} elseif (in_array($obj->id, $permsuser)) { // Permission granted by user
|
|
|
|
|
print '<!-- user has perm -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
|
|
|
//print img_edit_remove($langs->trans("Remove"));
|
|
|
|
|
print img_picto($langs->trans("Remove"), 'switch_on');
|
|
|
|
|
print '</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
|
|
|
|
|
print '<!-- permsgroupbyentitypluszero -->';
|
|
|
|
|
if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
//print img_picto($langs->trans("Active"), 'tick');
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
|
|
|
|
|
print '</td>';
|
|
|
|
|
} elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
|
|
|
|
|
print '<!-- permsgroupbyentitypluszero -->';
|
|
|
|
|
if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Active"), 'switch_on', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
//print img_picto($langs->trans("Active"), 'tick');
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
// Do not own permission
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
|
|
|
//print img_edit_add($langs->trans("Add"));
|
|
|
|
|
print img_picto($langs->trans("Add"), 'switch_off');
|
|
|
|
|
print '</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Do not own permission
|
|
|
|
|
print '<!-- do not own permission -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
|
|
|
@@ -686,71 +710,86 @@ if ($result) {
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Do not own permission
|
|
|
|
|
print '<!-- do not own permission -->';
|
|
|
|
|
if ($caneditperms) {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print '<a class="reposition addexpandedmodulesinparamlist" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'addrights', 'entity' => $entity, 'rights' => $obj->id, 'confirm' => 'yes', 'updatedmodulename' => $obj->module], true).'">';
|
|
|
|
|
//print img_edit_add($langs->trans("Add"));
|
|
|
|
|
print img_picto($langs->trans("Add"), 'switch_off');
|
|
|
|
|
print '</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center nowrap">';
|
|
|
|
|
print img_picto($langs->trans("Disabled"), 'switch_off', '', 0, 0, 0, '', 'opacitymedium');
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '<td>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Description of permission (1 or 2 columns)
|
|
|
|
|
if (!$user->admin) {
|
|
|
|
|
print '<td colspan="2">';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
}
|
|
|
|
|
if (!$user->admin) {
|
|
|
|
|
print '<td colspan="2">';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print $permlabel;
|
|
|
|
|
$idtouse = $obj->id;
|
|
|
|
|
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
|
|
|
|
$idtouse = 122;
|
|
|
|
|
}
|
|
|
|
|
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
|
|
|
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
|
|
|
|
}
|
|
|
|
|
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
|
|
|
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
|
|
|
|
}
|
|
|
|
|
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
|
|
|
|
if (preg_match('/_advance$/', $obj->perms)) {
|
|
|
|
|
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
|
|
|
|
}
|
|
|
|
|
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
|
|
|
|
$idtouse = 122;
|
|
|
|
|
}
|
|
|
|
|
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
|
|
|
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
|
|
|
|
}
|
|
|
|
|
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
|
|
|
|
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
|
|
|
|
}
|
|
|
|
|
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
|
|
|
|
if (preg_match('/_advance$/', $obj->perms)) {
|
|
|
|
|
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Special warning case for the permission "Allow to modify other users password"
|
|
|
|
|
if ($obj->module == 'user' && $obj->perms == 'user' && $obj->subperms == 'password') {
|
|
|
|
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
|
|
|
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
|
|
|
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
|
|
|
|
print ' '.img_warning($langs->trans("AllowPasswordResetBySendingANewPassByEmail"));
|
|
|
|
|
}
|
|
|
|
|
if ($obj->module == 'user' && $obj->perms == 'user' && $obj->subperms == 'password') {
|
|
|
|
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
|
|
|
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
|
|
|
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
|
|
|
|
print ' '.img_warning($langs->trans("AllowPasswordResetBySendingANewPassByEmail"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Special warning case for the permission "Create/modify other users, groups and permissions"
|
|
|
|
|
if ($obj->module == 'user' && $obj->perms == 'user' && ($obj->subperms == 'creer' || $obj->subperms == 'create')) {
|
|
|
|
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
|
|
|
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
|
|
|
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
|
|
|
|
print ' '.img_warning($langs->trans("AllowAnyPrivileges"));
|
|
|
|
|
}
|
|
|
|
|
if ($obj->module == 'user' && $obj->perms == 'user' && ($obj->subperms == 'creer' || $obj->subperms == 'create')) {
|
|
|
|
|
if ((!empty($object->admin) && !empty($objMod->rights_admin_allowed)) ||
|
|
|
|
|
in_array($obj->id, $permsuser) /* if edited user owns this permissions */ ||
|
|
|
|
|
(isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
|
|
|
|
|
print ' '.img_warning($langs->trans("AllowAnyPrivileges"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Special case for reading bank account when you have permission to manage Chart of account
|
|
|
|
|
if ($obj->module == 'banque' && $obj->perms == 'lire') {
|
|
|
|
|
if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) {
|
|
|
|
|
print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission"));
|
|
|
|
|
}
|
|
|
|
|
if ($obj->module == 'banque' && $obj->perms == 'lire') {
|
|
|
|
|
if (isModEnabled("accounting") && $object->hasRight('accounting', 'chartofaccount')) {
|
|
|
|
|
print ' '.img_warning($langs->trans("WarningReadBankAlsoAllowedIfUserHasPermission"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Permission id
|
|
|
|
|
if ($user->admin) {
|
|
|
|
|
print '<td class="right">';
|
|
|
|
|
$htmltext = $langs->trans("ID").': '.$obj->id;
|
|
|
|
|
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
|
|
|
|
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
|
|
|
|
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
if ($user->admin) {
|
|
|
|
|
print '<td class="right">';
|
|
|
|
|
$htmltext = $langs->trans("ID").': '.$obj->id;
|
|
|
|
|
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
|
|
|
|
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
|
|
|
|
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
print '</table>';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|