Fix: properly set gid for Group LDAP synchro

Even if the gidNumber field was set in the configuration, a gid different from the Dolibarr's one was generated and stored into LDAP.
Now the gidNumber is properly set to Dolibarr's gid if gidNumber field is set in the LDAP module configuration.
This commit is contained in:
piernov 2021-05-15 18:01:34 +02:00
parent b5c88d5817
commit 1cbe0e3f2d
No known key found for this signature in database
GPG Key ID: 46A3C65C574D3CDA
3 changed files with 5 additions and 5 deletions

View File

@ -282,8 +282,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if (in_array('posixGroup', $info['objectclass'])) {
// Get a gid number for objectclass PosixGroup if none was provided
if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) {
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
}

View File

@ -983,7 +983,7 @@ class UserGroup extends CommonObject
}
$info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield)?$valueofldapfield:'');
}
if(!empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID])){
if(!empty($conf->global->LDAP_GROUP_FIELD_GROUPID)){
$info[$conf->global->LDAP_GROUP_FIELD_GROUPID]=$this->id;
}
return $info;

View File

@ -69,8 +69,8 @@ if ($action == 'dolibarr2ldap')
{
$info=$object->_load_ldap_info();
// Get a gid number for objectclass PosixGroup
if (in_array('posixGroup', $info['objectclass'])) {
// Get a gid number for objectclass PosixGroup if none was provided
if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) {
$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
}