Merge pull request #9048 from hregis/8.0_rights
NEW possibility to add all rights of all modules in one time
This commit is contained in:
commit
31d5b739e7
@ -1203,8 +1203,11 @@ else
|
||||
$res=$object->fetch_optionals();
|
||||
|
||||
// Check if user has rights
|
||||
$object->getrights();
|
||||
if (empty($object->nb_rights) && $object->statut != 0) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings');
|
||||
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
$object->getrights();
|
||||
if (empty($object->nb_rights) && $object->statut != 0) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings');
|
||||
}
|
||||
|
||||
// Connexion ldap
|
||||
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
||||
|
||||
@ -487,8 +487,15 @@ class User extends CommonObject
|
||||
// Where pour la liste des droits a ajouter
|
||||
if (! empty($allmodule))
|
||||
{
|
||||
$whereforadd="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||
if ($allmodule == 'allmodules')
|
||||
{
|
||||
$whereforadd='allmodules';
|
||||
}
|
||||
else
|
||||
{
|
||||
$whereforadd="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,8 +505,10 @@ class User extends CommonObject
|
||||
//print "$module-$perms-$subperms";
|
||||
$sql = "SELECT id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE ".$whereforadd;
|
||||
$sql.= " AND entity = ".$entity;
|
||||
$sql.= " WHERE entity = ".$entity;
|
||||
if (! empty($whereforadd) && $whereforadd != 'allmodules') {
|
||||
$sql.= " AND ".$whereforadd;
|
||||
}
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
@ -600,8 +609,18 @@ class User extends CommonObject
|
||||
else {
|
||||
// On a demande suppression d'un droit sur la base d'un nom de module ou perms
|
||||
// Where pour la liste des droits a supprimer
|
||||
if (! empty($allmodule)) $wherefordel="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $wherefordel=" AND perms='".$this->db->escape($allperms)."'";
|
||||
if (! empty($allmodule))
|
||||
{
|
||||
if ($allmodule == 'allmodules')
|
||||
{
|
||||
$wherefordel='allmodules';
|
||||
}
|
||||
else
|
||||
{
|
||||
$wherefordel="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppression des droits selon critere defini dans wherefordel
|
||||
@ -610,8 +629,10 @@ class User extends CommonObject
|
||||
//print "$module-$perms-$subperms";
|
||||
$sql = "SELECT id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE $wherefordel";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
$sql.= " WHERE entity = ".$entity;
|
||||
if (! empty($wherefordel) && $wherefordel != 'allmodules') {
|
||||
$sql.= " AND ".$wherefordel;
|
||||
}
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -308,8 +308,18 @@ class UserGroup extends CommonObject
|
||||
}
|
||||
else {
|
||||
// Where pour la liste des droits a ajouter
|
||||
if (! empty($allmodule)) $whereforadd="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd=" AND perms='".$this->db->escape($allperms)."'";
|
||||
if (! empty($allmodule))
|
||||
{
|
||||
if ($allmodule == 'allmodules')
|
||||
{
|
||||
$whereforadd='allmodules';
|
||||
}
|
||||
else
|
||||
{
|
||||
$whereforadd="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ajout des droits de la liste whereforadd
|
||||
@ -318,8 +328,10 @@ class UserGroup extends CommonObject
|
||||
//print "$module-$perms-$subperms";
|
||||
$sql = "SELECT id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE $whereforadd";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
$sql.= " WHERE entity = ".$entity;
|
||||
if (! empty($whereforadd) && $whereforadd != 'allmodules') {
|
||||
$sql.= " AND ".$whereforadd;
|
||||
}
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
@ -422,8 +434,18 @@ class UserGroup extends CommonObject
|
||||
}
|
||||
else {
|
||||
// Where pour la liste des droits a supprimer
|
||||
if (! empty($allmodule)) $wherefordel="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $wherefordel=" AND perms='".$this->db->escape($allperms)."'";
|
||||
if (! empty($allmodule))
|
||||
{
|
||||
if ($allmodule == 'allmodules')
|
||||
{
|
||||
$wherefordel='allmodules';
|
||||
}
|
||||
else
|
||||
{
|
||||
$wherefordel="module='".$this->db->escape($allmodule)."'";
|
||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppression des droits de la liste wherefordel
|
||||
@ -432,8 +454,10 @@ class UserGroup extends CommonObject
|
||||
//print "$module-$perms-$subperms";
|
||||
$sql = "SELECT id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE $wherefordel";
|
||||
$sql.= " AND entity = ".$entity;
|
||||
$sql.= " WHERE entity = ".$entity;
|
||||
if (! empty($wherefordel) && $wherefordel != 'allmodules') {
|
||||
$sql.= " AND ".$wherefordel;
|
||||
}
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -231,7 +231,14 @@ if ($object->id > 0)
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
if ($caneditperms) print '<td width="24"> </td>';
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&module=allmodules">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module=allmodules">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center" width="24"> </td>';
|
||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -260,7 +260,14 @@ print "\n";
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
if ($caneditperms) print '<td> </td>';
|
||||
if ($caneditperms && empty($objMod->rights_admin_allowed) || empty($object->admin))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&module=allmodules">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module=allmodules">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center" width="24"> </td>';
|
||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user