commit
cd4151bbdd
@ -64,6 +64,9 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $ismultientitymanaged = 1;
|
public $ismultientitymanaged = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string picto
|
||||||
|
*/
|
||||||
public $picto = 'user';
|
public $picto = 'user';
|
||||||
|
|
||||||
public $id = 0;
|
public $id = 0;
|
||||||
@ -73,7 +76,15 @@ class User extends CommonObject
|
|||||||
public $employee;
|
public $employee;
|
||||||
public $gender;
|
public $gender;
|
||||||
public $birth;
|
public $birth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string email
|
||||||
|
*/
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string personal email
|
||||||
|
*/
|
||||||
public $personal_email;
|
public $personal_email;
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +101,14 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $address;
|
public $address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string zip code
|
||||||
|
*/
|
||||||
public $zip;
|
public $zip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string town
|
||||||
|
*/
|
||||||
public $town;
|
public $town;
|
||||||
public $state_id; // The state/department
|
public $state_id; // The state/department
|
||||||
public $state_code;
|
public $state_code;
|
||||||
@ -108,11 +126,19 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
//! Clear password in memory
|
/**
|
||||||
|
* @var string Clear password in memory
|
||||||
|
*/
|
||||||
public $pass;
|
public $pass;
|
||||||
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
|
|
||||||
|
/**
|
||||||
|
* @var string Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
|
||||||
|
*/
|
||||||
public $pass_indatabase;
|
public $pass_indatabase;
|
||||||
//! Encrypted password in database (always defined)
|
|
||||||
|
/**
|
||||||
|
* @var string Encrypted password in database (always defined)
|
||||||
|
*/
|
||||||
public $pass_indatabase_crypted;
|
public $pass_indatabase_crypted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -284,29 +310,25 @@ class User extends CommonObject
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
|
||||||
|
|
||||||
if ($entity < 0)
|
if ($entity < 0) {
|
||||||
{
|
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) {
|
||||||
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity)))
|
|
||||||
{
|
|
||||||
$sql .= " WHERE u.entity IN (0,".$conf->entity.")";
|
$sql .= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||||
}
|
}
|
||||||
} else // The fetch was forced on an entity
|
} else {// The fetch was forced on an entity
|
||||||
{
|
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
|
||||||
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||||
else $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter
|
} else {
|
||||||
|
$sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba
|
if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
|
||||||
{
|
|
||||||
$sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1";
|
$sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1";
|
||||||
} elseif ($login)
|
} elseif ($login) {
|
||||||
{
|
|
||||||
$sql .= " AND u.login = '".$this->db->escape($login)."'";
|
$sql .= " AND u.login = '".$this->db->escape($login)."'";
|
||||||
} elseif ($email)
|
} elseif ($email) {
|
||||||
{
|
|
||||||
$sql .= " AND u.email = '".$this->db->escape($email)."'";
|
$sql .= " AND u.email = '".$this->db->escape($email)."'";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND u.rowid = ".$id;
|
$sql .= " AND u.rowid = ".$id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user