NEW possibility to add all rights of all modules in one time
This commit is contained in:
parent
d4d9a8d75a
commit
ca13d7b560
@ -484,8 +484,15 @@ class User extends CommonObject
|
|||||||
// Where pour la liste des droits a ajouter
|
// Where pour la liste des droits a ajouter
|
||||||
if (! empty($allmodule))
|
if (! empty($allmodule))
|
||||||
{
|
{
|
||||||
$whereforadd="module='".$this->db->escape($allmodule)."'";
|
if ($allmodule == 'allmodules')
|
||||||
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
{
|
||||||
|
$whereforadd='allmodules';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$whereforadd="module='".$this->db->escape($allmodule)."'";
|
||||||
|
if (! empty($allperms)) $whereforadd.=" AND perms='".$this->db->escape($allperms)."'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,8 +502,10 @@ class User extends CommonObject
|
|||||||
//print "$module-$perms-$subperms";
|
//print "$module-$perms-$subperms";
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||||
$sql.= " WHERE ".$whereforadd;
|
$sql.= " WHERE entity = ".$entity;
|
||||||
$sql.= " AND entity = ".$entity;
|
if (! empty($whereforadd) && $whereforadd != 'allmodules') {
|
||||||
|
$sql.= " AND ".$whereforadd;
|
||||||
|
}
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -597,8 +606,18 @@ class User extends CommonObject
|
|||||||
else {
|
else {
|
||||||
// On a demande suppression d'un droit sur la base d'un nom de module ou perms
|
// 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
|
// Where pour la liste des droits a supprimer
|
||||||
if (! empty($allmodule)) $wherefordel="module='".$this->db->escape($allmodule)."'";
|
if (! empty($allmodule))
|
||||||
if (! empty($allperms)) $wherefordel=" AND perms='".$this->db->escape($allperms)."'";
|
{
|
||||||
|
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
|
// Suppression des droits selon critere defini dans wherefordel
|
||||||
@ -607,8 +626,10 @@ class User extends CommonObject
|
|||||||
//print "$module-$perms-$subperms";
|
//print "$module-$perms-$subperms";
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||||
$sql.= " WHERE $wherefordel";
|
$sql.= " WHERE entity = ".$entity;
|
||||||
$sql.= " AND entity = ".$entity;
|
if (! empty($wherefordel) && $wherefordel != 'allmodules') {
|
||||||
|
$sql.= " AND ".$wherefordel;
|
||||||
|
}
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -308,8 +308,18 @@ class UserGroup extends CommonObject
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Where pour la liste des droits a ajouter
|
// Where pour la liste des droits a ajouter
|
||||||
if (! empty($allmodule)) $whereforadd="module='".$this->db->escape($allmodule)."'";
|
if (! empty($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)."'";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajout des droits de la liste whereforadd
|
// Ajout des droits de la liste whereforadd
|
||||||
@ -318,8 +328,10 @@ class UserGroup extends CommonObject
|
|||||||
//print "$module-$perms-$subperms";
|
//print "$module-$perms-$subperms";
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||||
$sql.= " WHERE $whereforadd";
|
$sql.= " WHERE entity = ".$entity;
|
||||||
$sql.= " AND entity = ".$entity;
|
if (! empty($whereforadd) && $whereforadd != 'allmodules') {
|
||||||
|
$sql.= " AND ".$whereforadd;
|
||||||
|
}
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -422,8 +434,18 @@ class UserGroup extends CommonObject
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Where pour la liste des droits a supprimer
|
// Where pour la liste des droits a supprimer
|
||||||
if (! empty($allmodule)) $wherefordel="module='".$this->db->escape($allmodule)."'";
|
if (! empty($allmodule))
|
||||||
if (! empty($allperms)) $wherefordel=" AND perms='".$this->db->escape($allperms)."'";
|
{
|
||||||
|
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
|
// Suppression des droits de la liste wherefordel
|
||||||
@ -432,8 +454,10 @@ class UserGroup extends CommonObject
|
|||||||
//print "$module-$perms-$subperms";
|
//print "$module-$perms-$subperms";
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
|
||||||
$sql.= " WHERE $wherefordel";
|
$sql.= " WHERE entity = ".$entity;
|
||||||
$sql.= " AND entity = ".$entity;
|
if (! empty($wherefordel) && $wherefordel != 'allmodules') {
|
||||||
|
$sql.= " AND ".$wherefordel;
|
||||||
|
}
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -231,7 +231,14 @@ if ($object->id > 0)
|
|||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Module").'</td>';
|
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 align="center" width="24"> </td>';
|
||||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -260,7 +260,14 @@ print "\n";
|
|||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Module").'</td>';
|
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 align="center" width="24"> </td>';
|
||||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user