Hello,
With Dolibarr 3.1, I have an error in the LDAP module when creating a
user group. In the LDAP directory, I use the object class 'posixGroup'
that requires guidNumber as an attribute.
A corrective patch is attached (new function to retrieve a gidnumber
from LDAP directory ).
diff --git a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php
index db210aa..32e0b85 100644
--- a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php
+++ b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php
@@ -218,7 +218,11 @@ class InterfaceLdapsynchro
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
-
+
+ // Get a gid number for objectclass PosixGroup
+ if(in_array('posixGroup',$info['objectclass']))
+ $info['gidNumber'] = $ldap->getNextGroupGid();
+
$result=$ldap->add($dn,$info,$user);
if ($result < 0)
{
diff --git a/htdocs/lib/ldap.class.php b/htdocs/lib/ldap.class.php
index 42ba2e6..59e77dc 100644
--- a/htdocs/lib/ldap.class.php
+++ b/htdocs/lib/ldap.class.php
@@ -1316,6 +1316,33 @@ class Ldap
if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
return $str;
}
+
+
+ /**
+ * \brief Return available value of group GID
+ * \param
+ * \return int gid number
+ */
+ function getNextGroupGid() {
+ global $conf;
+ $search='('.$conf->global->LDAP_KEY_GROUPS.'=*)';
+ $result = $this->search($this->groups,$search);
+ if($result) {
+ $c = $result['count'];
+ $gids = array();
+ for($i=0;$i<$c;$i++)
+ {
+ $gids[] = $result[$i]['gidnumber'][0];
+ }
+ rsort($gids);
+
+
+ return $gids[0]+1;
+ }
+
+ return 0;
+
+ }
}
_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev