Fix: cvs<->git problem
This commit is contained in:
parent
fe27643152
commit
5183fd9e86
@ -31,7 +31,7 @@
|
||||
* \file htdocs/core/class/html.form.class.php
|
||||
* \ingroup core
|
||||
* \brief File of class with all html predefined components
|
||||
* \version $Id: html.form.class.php,v 1.202 2011/08/20 15:11:32 eldy Exp $
|
||||
* \version $Id: html.form.class.php,v 1.203 2011/08/21 00:20:44 hregis Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -822,13 +822,14 @@ class Form
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
$userstatic=new User($this->db);
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
|
||||
$userstatic=new User($this->db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -866,6 +867,11 @@ class Form
|
||||
$out.= '</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<select class="flat" name="'.$htmlname.'" disabled="disabled">';
|
||||
$out.= '<option value="">'.$langs->trans("EmptyList").'</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
}
|
||||
@ -3514,10 +3520,11 @@ class Form
|
||||
* @param disabled If select list must be disabled
|
||||
* @param include Array list of groups id to include
|
||||
* @param enableonly Array list of groups id to be enabled. All other must be disabled
|
||||
* @param force_entity Possibility to force entity
|
||||
*/
|
||||
function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='')
|
||||
function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity)
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$user,$langs;
|
||||
|
||||
// Permettre l'exclusion de groupes
|
||||
if (is_array($exclude)) $excludeGroups = implode("','",$exclude);
|
||||
@ -3528,15 +3535,16 @@ class Form
|
||||
|
||||
// On recherche les groupes
|
||||
$sql = "SELECT ug.rowid, ug.nom ";
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= ", e.label";
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as ug ";
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e on e.rowid=ug.entity";
|
||||
$sql.= " WHERE ug.entity IS NOT NULL";
|
||||
if ($force_entity) $sql.= " WHERE ug.entity IN (0,".$force_entity.")";
|
||||
else $sql.= " WHERE ug.entity IS NOT NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3550,12 +3558,13 @@ class Form
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
$out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -3580,6 +3589,11 @@ class Form
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<select class="flat" name="'.$htmlname.'" disabled="disabled">';
|
||||
$out.= '<option value="">'.$langs->trans("EmptyList").'</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
/**
|
||||
* \file htdocs/user/class/user.class.php
|
||||
* \brief Fichier de la classe utilisateur
|
||||
* \version $Id: user.class.php,v 1.51 2011/08/20 23:56:03 eldy Exp $
|
||||
* \version $Id: user.class.php,v 1.52 2011/08/21 00:20:43 hregis Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||
@ -146,7 +146,7 @@ class User extends CommonObject
|
||||
$sql.= " u.openid as openid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
{
|
||||
$sql.= " WHERE u.entity IS NOT NULL";
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
* \file htdocs/user/class/usergroup.class.php
|
||||
* \brief Fichier de la classe des groupes d'utilisateur
|
||||
* \author Rodolphe Qiedeville
|
||||
* \version $Id: usergroup.class.php,v 1.14 2011/08/19 22:15:22 hregis Exp $
|
||||
* \version $Id: usergroup.class.php,v 1.15 2011/08/21 00:20:43 hregis Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
@ -120,7 +120,7 @@ class UserGroup extends CommonObject
|
||||
*/
|
||||
function listGroupsForUser($userid)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
|
||||
$ret=array();
|
||||
|
||||
@ -130,7 +130,7 @@ class UserGroup extends CommonObject
|
||||
$sql.= " WHERE ug.fk_usergroup = g.rowid";
|
||||
$sql.= " AND ug.fk_user = ".$userid;
|
||||
|
||||
if($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)
|
||||
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " AND g.entity IS NOT NULL";
|
||||
}
|
||||
@ -172,7 +172,7 @@ class UserGroup extends CommonObject
|
||||
*/
|
||||
function listUsersForGroup()
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
|
||||
$ret=array();
|
||||
|
||||
@ -182,7 +182,7 @@ class UserGroup extends CommonObject
|
||||
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||
$sql.= " AND ug.fk_usergroup = ".$this->id;
|
||||
|
||||
if($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)
|
||||
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " AND u.entity IS NOT NULL";
|
||||
}
|
||||
@ -197,11 +197,11 @@ class UserGroup extends CommonObject
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($result))
|
||||
{
|
||||
$user=new User($this->db);
|
||||
$user->fetch($obj->rowid);
|
||||
$user->usergroup_entity = $obj->usergroup_entity;
|
||||
$userstatic=new User($this->db);
|
||||
$userstatic->fetch($obj->rowid);
|
||||
$userstatic->usergroup_entity = $obj->usergroup_entity;
|
||||
|
||||
$ret[]=$user;
|
||||
$ret[]=$userstatic;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
@ -455,8 +455,8 @@ class UserGroup extends CommonObject
|
||||
{
|
||||
$this->rights->$row[0]->$row[1] = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* \file htdocs/user/fiche.php
|
||||
* \brief Tab of user card
|
||||
* \version $Id: fiche.php,v 1.279 2011/08/19 22:15:23 hregis Exp $
|
||||
* \version $Id: fiche.php,v 1.280 2011/08/21 00:20:44 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@ -1292,7 +1292,7 @@ else
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("GroupsToAdd").'</td>'."\n";
|
||||
print '<td>';
|
||||
print $form->select_dolgroups('','group',1,$exclude);
|
||||
print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity);
|
||||
print ' ';
|
||||
// Multicompany
|
||||
if ($conf->multicompany->enabled)
|
||||
@ -1776,7 +1776,7 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/19 22:15:23 $ - $Revision: 1.279 $');
|
||||
llxFooter('$Date: 2011/08/21 00:20:44 $ - $Revision: 1.280 $');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/**
|
||||
* \file htdocs/user/group/fiche.php
|
||||
* \brief Onglet groupes utilisateurs
|
||||
* \version $Id: fiche.php,v 1.75 2011/08/20 09:03:38 hregis Exp $
|
||||
* \version $Id: fiche.php,v 1.76 2011/08/21 00:20:44 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@ -44,6 +44,11 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
$langs->load("users");
|
||||
$langs->load("other");
|
||||
|
||||
$id=GETPOST("id");
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST("confirm");
|
||||
$userid=GETPOST("user","int");
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'user', $_GET["id"], 'usergroup', 'user');
|
||||
|
||||
@ -52,10 +57,6 @@ if($conf->multicompany->enabled && $conf->entity > 1 && $conf->global->MULTICOMP
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST("confirm");
|
||||
$userid=GETPOST("user","int");
|
||||
|
||||
$object = new Usergroup($db);
|
||||
|
||||
|
||||
@ -80,7 +81,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
|
||||
/**
|
||||
* Action add group
|
||||
*/
|
||||
if ($_POST["action"] == 'add')
|
||||
if ($action == 'add')
|
||||
{
|
||||
if($caneditperms)
|
||||
{
|
||||
@ -131,7 +132,7 @@ if ($action == 'adduser' || $action =='removeuser')
|
||||
{
|
||||
if ($userid)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
$object->oldcopy=dol_clone($object);
|
||||
|
||||
$edituser = new User($db);
|
||||
@ -157,7 +158,7 @@ if ($action == 'adduser' || $action =='removeuser')
|
||||
}
|
||||
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
if ($action == 'update')
|
||||
{
|
||||
if($caneditperms)
|
||||
{
|
||||
@ -165,7 +166,7 @@ if ($_POST["action"] == 'update')
|
||||
|
||||
$db->begin();
|
||||
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy=dol_clone($object);
|
||||
|
||||
@ -261,9 +262,9 @@ if ($action == 'create')
|
||||
/* ************************************************************************** */
|
||||
else
|
||||
{
|
||||
if ($_GET["id"] )
|
||||
if ($id)
|
||||
{
|
||||
$object->fetch($_GET["id"]);
|
||||
$object->fetch($id);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
@ -352,14 +353,12 @@ else
|
||||
|
||||
// On selectionne les users qui ne sont pas deja dans le groupe
|
||||
$exclude = array();
|
||||
|
||||
$userslist = $object->listUsersForGroup();
|
||||
|
||||
if (! empty($userslist))
|
||||
if (! empty($object->members))
|
||||
{
|
||||
if( !($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
foreach($userslist as $useringroup)
|
||||
foreach($object->members as $useringroup)
|
||||
{
|
||||
$exclude[]=$useringroup->id;
|
||||
}
|
||||
@ -374,7 +373,7 @@ else
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
||||
print '<td>';
|
||||
print $form->select_users('','user',1,$exclude,0,'','',$object->entity);
|
||||
print $form->select_dolusers('','user',1,$exclude,0,'','',$object->entity);
|
||||
print ' ';
|
||||
// Multicompany
|
||||
if ($conf->multicompany->enabled)
|
||||
@ -405,23 +404,22 @@ else
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Login").'</td>';
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Lastname").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Firstname").'</td>';
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
{
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Entity").'</td>';
|
||||
}
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Lastname").'</td>';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Firstname").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("Status").'</td>';
|
||||
print '<td> </td>';
|
||||
print "<td> </td>";
|
||||
print '<td class="liste_titre" width="5" align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="liste_titre" width="5" align="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (! empty($userslist))
|
||||
if (! empty($object->members))
|
||||
{
|
||||
$var=True;
|
||||
|
||||
foreach($userslist as $useringroup)
|
||||
|
||||
foreach($object->members as $useringroup)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -431,16 +429,15 @@ else
|
||||
if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
||||
print '</td>';
|
||||
print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
|
||||
print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
|
||||
if($conf->multicompany->enabled && $conf->entity == 1)
|
||||
{
|
||||
$mc = new ActionsMulticompany($db);
|
||||
$mc->getInfo($useringroup->usergroup_entity);
|
||||
print '<td class="valeur">'.$mc->label."</td>";
|
||||
}
|
||||
print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
|
||||
print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
|
||||
print '<td align="right">'.$useringroup->getLibStatut(5).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center">'.$useringroup->getLibStatut(3).'</td>';
|
||||
print '<td align="right">';
|
||||
if ($user->admin)
|
||||
{
|
||||
@ -521,5 +518,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/20 09:03:38 $ - $Revision: 1.75 $');
|
||||
llxFooter('$Date: 2011/08/21 00:20:44 $ - $Revision: 1.76 $');
|
||||
?>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/user/group/perms.php
|
||||
* \brief Onglet user et permissions de la fiche utilisateur
|
||||
* \version $Id: perms.php,v 1.41 2011/08/17 15:56:24 eldy Exp $
|
||||
* \version $Id: perms.php,v 1.42 2011/08/21 00:20:43 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@ -31,7 +31,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
|
||||
|
||||
$langs->load("users");
|
||||
|
||||
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
|
||||
$id=GETPOST("id");
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST("confirm");
|
||||
$module=GETPOST("module");
|
||||
|
||||
// Defini si peux lire les permissions
|
||||
$canreadperms=($user->admin || $user->rights->user->user->lire);
|
||||
@ -52,17 +55,17 @@ if (! $canreadperms) accessforbidden();
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
if ($_GET["action"] == 'addrights' && $caneditperms)
|
||||
if ($action == 'addrights' && $caneditperms)
|
||||
{
|
||||
$editgroup = new Usergroup($db);
|
||||
$result=$editgroup->fetch($_GET["id"]);
|
||||
$result=$editgroup->fetch($id);
|
||||
if ($result > 0) $editgroup->addrights($_GET["rights"],$module);
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delrights' && $caneditperms)
|
||||
if ($action == 'delrights' && $caneditperms)
|
||||
{
|
||||
$editgroup = new Usergroup($db);
|
||||
$result=$editgroup->fetch($_GET["id"]);
|
||||
$result=$editgroup->fetch($id);
|
||||
if ($result > 0) $editgroup->delrights($_GET["rights"],$module);
|
||||
}
|
||||
|
||||
@ -75,10 +78,10 @@ $form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Permissions"));
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($id)
|
||||
{
|
||||
$fgroup = new Usergroup($db);
|
||||
$fgroup->fetch($_GET["id"]);
|
||||
$fgroup->fetch($id);
|
||||
$fgroup->getrights();
|
||||
|
||||
/*
|
||||
@ -167,7 +170,7 @@ if ($_GET["id"])
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."usergroup_rights as ugr";
|
||||
$sql.= " WHERE ugr.fk_id = r.id";
|
||||
$sql.= " AND r.entity = ".$conf->entity;
|
||||
$sql.= " AND r.entity = ".$fgroup->entity;
|
||||
$sql.= " AND ugr.fk_usergroup = ".$fgroup->id;
|
||||
|
||||
$result=$db->query($sql);
|
||||
@ -232,7 +235,7 @@ if ($_GET["id"])
|
||||
$sql = "SELECT r.id, r.libelle, r.module";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql.= " AND r.entity = ".$conf->entity;
|
||||
$sql.= " AND r.entity = ".$fgroup->entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
|
||||
$sql.= " ORDER BY r.module, r.id";
|
||||
|
||||
@ -316,5 +319,5 @@ if ($_GET["id"])
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/17 15:56:24 $ - $Revision: 1.41 $');
|
||||
llxFooter('$Date: 2011/08/21 00:20:43 $ - $Revision: 1.42 $');
|
||||
?>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/user/perms.php
|
||||
* \brief Onglet user et permissions de la fiche utilisateur
|
||||
* \version $Id: perms.php,v 1.58 2011/08/17 15:56:25 eldy Exp $
|
||||
* \version $Id: perms.php,v 1.59 2011/08/21 00:20:44 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@ -31,9 +31,12 @@ require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
|
||||
$langs->load("users");
|
||||
$langs->load("admin");
|
||||
|
||||
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
|
||||
$id=GETPOST("id");
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST("confirm");
|
||||
$module=GETPOST("module");
|
||||
|
||||
if (! isset($_GET["id"]) || empty($_GET["id"])) accessforbidden();
|
||||
if (! isset($id) || empty($id)) accessforbidden();
|
||||
|
||||
// Defini si peux lire les permissions
|
||||
$canreaduser=($user->admin || $user->rights->user->user->lire);
|
||||
@ -43,7 +46,7 @@ $caneditperms=($user->admin || $user->rights->user->user->creer);
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
{
|
||||
$canreaduser=($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
|
||||
$caneditselfperms=($user->id == $_GET["id"] && $user->rights->user->self_advance->writeperms);
|
||||
$caneditselfperms=($user->id == $id && $user->rights->user->self_advance->writeperms);
|
||||
$caneditperms = '('.$caneditperms.' || '.$caneditselfperms.')';
|
||||
}
|
||||
|
||||
@ -51,40 +54,40 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||
if ($user->id == $_GET["id"]) // A user can always read its own card
|
||||
if ($user->id == $id) // A user can always read its own card
|
||||
{
|
||||
$feature2='';
|
||||
$canreaduser=1;
|
||||
}
|
||||
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
||||
if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
|
||||
$result = restrictedArea($user, 'user', $id, '', $feature2);
|
||||
if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
||||
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
if ($_GET["action"] == 'addrights' && $caneditperms)
|
||||
if ($action == 'addrights' && $caneditperms)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$edituser->fetch($_GET["id"]);
|
||||
$edituser->fetch($id);
|
||||
$edituser->addrights($_GET["rights"],$module);
|
||||
|
||||
// Si on a touche a ses propres droits, on recharge
|
||||
if ($_GET["id"] == $user->id)
|
||||
if ($id == $user->id)
|
||||
{
|
||||
$user->clearrights();
|
||||
$user->getrights();
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delrights' && $caneditperms)
|
||||
if ($action == 'delrights' && $caneditperms)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$edituser->fetch($_GET["id"]);
|
||||
$edituser->fetch($id);
|
||||
$edituser->delrights($_GET["rights"],$module);
|
||||
|
||||
// Si on a touche a ses propres droits, on recharge
|
||||
if ($_GET["id"] == $user->id)
|
||||
if ($id == $user->id)
|
||||
{
|
||||
$user->clearrights();
|
||||
$user->getrights();
|
||||
@ -104,7 +107,7 @@ llxHeader('',$langs->trans("Permissions"));
|
||||
$form=new Form($db);
|
||||
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($_GET["id"]);
|
||||
$fuser->fetch($id);
|
||||
$fuser->getrights();
|
||||
|
||||
/*
|
||||
@ -192,7 +195,7 @@ $sql = "SELECT r.id, r.libelle, r.module";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur";
|
||||
$sql.= " WHERE ur.fk_id = r.id";
|
||||
$sql.= " AND r.entity = ".$conf->entity;
|
||||
$sql.= " AND r.entity = ".$fuser->entity;
|
||||
$sql.= " AND ur.fk_user = ".$fuser->id;
|
||||
|
||||
$result=$db->query($sql);
|
||||
@ -221,8 +224,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."usergroup_rights as gr,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu";
|
||||
$sql.= " WHERE gr.fk_id = r.id";
|
||||
$sql.= " AND r.entity = ".$conf->entity;
|
||||
$sql.= " AND gu.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " AND r.entity = ".$fuser->entity;
|
||||
$sql.= " AND gu.entity IN (0,".$fuser->entity.")";
|
||||
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
|
||||
$sql.= " AND gu.fk_user = ".$fuser->id;
|
||||
|
||||
@ -285,7 +288,7 @@ print '</tr>'."\n";
|
||||
$sql = "SELECT r.id, r.libelle, r.module";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql.= " AND r.entity = ".$conf->entity;
|
||||
$sql.= " AND r.entity = ".$fuser->entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
|
||||
$sql.= " ORDER BY r.module, r.id";
|
||||
|
||||
@ -395,5 +398,5 @@ print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/17 15:56:25 $ - $Revision: 1.58 $');
|
||||
llxFooter('$Date: 2011/08/21 00:20:44 $ - $Revision: 1.59 $');
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user