Fix: API auth fails in multicompany transverse mode when user has several groups (#39409)
This commit is contained in:
parent
ea1443e09e
commit
322e41b81a
1 changed files with 2 additions and 2 deletions
|
|
@ -136,7 +136,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||
|
||||
if (!getDolGlobalString('API_IN_TOKEN_TABLE')) {
|
||||
if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && defined("DOLENTITY")) {
|
||||
$sql = "SELECT u.login, u.datec, u.api_key as use_api, u.api_key as api_key, 0 as token_rowid,";
|
||||
$sql = "SELECT DISTINCT u.login, u.datec, u.api_key as use_api, u.api_key as api_key, 0 as token_rowid,";
|
||||
$sql .= " u.tms as date_modification,";
|
||||
$sql .= " gu.entity, gu.entity as token_entity";
|
||||
$sql .= " FROM ".$this->db->prefix()."user as u";
|
||||
|
|
@ -150,7 +150,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||
}
|
||||
} else {
|
||||
if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && defined("DOLENTITY")) {
|
||||
$sql = "SELECT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,";
|
||||
$sql = "SELECT DISTINCT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,";
|
||||
$sql .= " oat.tms as date_modification,";
|
||||
$sql .= " gu.entity";
|
||||
$sql .= " FROM ".$this->db->prefix()."oauth_token AS oat";
|
||||
|
|
|
|||
Loading…
Reference in a new issue