Fix: Some admin users have not all features of admin.
This commit is contained in:
parent
ea1913d2e6
commit
9689707a92
@ -172,7 +172,7 @@ if ($_POST["action"] == 'add' && $canadduser)
|
|||||||
|
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
|
|
||||||
if (!empty($conf->file->main_limit_users))
|
if (!empty($conf->file->main_limit_users)) // If option to limit users is set
|
||||||
{
|
{
|
||||||
$nb = $edituser->getNbOfUsers(1);
|
$nb = $edituser->getNbOfUsers(1);
|
||||||
if ($nb >= $conf->file->main_limit_users)
|
if ($nb >= $conf->file->main_limit_users)
|
||||||
@ -197,7 +197,7 @@ if ($_POST["action"] == 'add' && $canadduser)
|
|||||||
$edituser->phenix_pass = $_POST["phenix_pass"];
|
$edituser->phenix_pass = $_POST["phenix_pass"];
|
||||||
$edituser->note = $_POST["note"];
|
$edituser->note = $_POST["note"];
|
||||||
$edituser->ldap_sid = $_POST["ldap_sid"];
|
$edituser->ldap_sid = $_POST["ldap_sid"];
|
||||||
$edituser->entity = $_POST["entity"];
|
$edituser->entity = ($_POST["admin"] && empty($conf->multicompany->enabled))?0:$_POST["entity"]; // If multicompany is off, admin users must all be on entity 0.
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -1173,32 +1173,32 @@ else
|
|||||||
/*
|
/*
|
||||||
* Liste des groupes dans lequel est l'utilisateur
|
* Liste des groupes dans lequel est l'utilisateur
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($canreadgroup)
|
if ($canreadgroup)
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("ListOfGroupsForUser"),'','');
|
print_fiche_titre($langs->trans("ListOfGroupsForUser"),'','');
|
||||||
|
|
||||||
// On selectionne les groupes auquel fait parti le user
|
// On selectionne les groupes auquel fait parti le user
|
||||||
// TODO move sql query to dao class
|
// TODO move sql query to dao class
|
||||||
$grouplistid = array();
|
$grouplistid = array();
|
||||||
|
|
||||||
$sql = "SELECT ug.fk_usergroup";
|
$sql = "SELECT ug.fk_usergroup";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."usergroup as u";
|
$sql.= ", ".MAIN_DB_PREFIX."usergroup as u";
|
||||||
$sql.= " WHERE ug.fk_user = ".$fuser->id;
|
$sql.= " WHERE ug.fk_user = ".$fuser->id;
|
||||||
$sql.= " AND ug.fk_usergroup = u.rowid";
|
$sql.= " AND ug.fk_usergroup = u.rowid";
|
||||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
$grouplistid[]=$obj->fk_usergroup;
|
$grouplistid[]=$obj->fk_usergroup;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1206,9 +1206,9 @@ else
|
|||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
if ($caneditgroup)
|
if ($caneditgroup)
|
||||||
{
|
{
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
@ -1223,32 +1223,32 @@ else
|
|||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
print '</table></form>'."\n";
|
print '</table></form>'."\n";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Groupes affectes
|
* Groupes affectes
|
||||||
*/
|
*/
|
||||||
$usergroup=new UserGroup($db);
|
$usergroup=new UserGroup($db);
|
||||||
$listofgroups=$usergroup->listGroupsForUser($fuser);
|
$listofgroups=$usergroup->listGroupsForUser($fuser);
|
||||||
$num=sizeof($listofgroups);
|
$num=sizeof($listofgroups);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>';
|
print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>';
|
||||||
print "<td> </td></tr>\n";
|
print "<td> </td></tr>\n";
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$group = $listofgroups[$i];
|
$group = $listofgroups[$i];
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($caneditgroup)
|
if ($caneditgroup)
|
||||||
@ -1261,7 +1261,7 @@ else
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
|
|
||||||
if ($caneditgroup)
|
if ($caneditgroup)
|
||||||
{
|
{
|
||||||
print '<a href="fiche.php?id='.$_GET["id"].'&action=removegroup&group='.$group->id.'">';
|
print '<a href="fiche.php?id='.$_GET["id"].'&action=removegroup&group='.$group->id.'">';
|
||||||
@ -1279,7 +1279,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[false].'><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user