3

I am trying to add groups to an LDAP server

I have used the below code to add groups:

$ldap = new LDAP();
$connection = $ldap->connect($ldap->ldapserver,$ldap->ldapport);
$ldap->bind($connection,'cn=zentyal,dc=test,dc=org','k8ddfffdIsdefdfsdfsfi9');
$groupAtt['cn'] = $group_name;
$groupAtt['description'] = $group_description;
$groupAtt['objectClass'][0] = "posixGroup";
$groupAtt['objectClass'][1] = "zentyalGroup";
$groupAtt['gidNumber'] = "3000";

$addGroup = "cn=".$group_name.",ou=Groups,dc=test,dc=org";
$ldapcreation = $ldap->addRecord($connection,$addGroup,$groupAtt);

The code in the function addRecord is

function addRecord($connection, $adddn, $record){

    $addProcess = ldap_add($connection, $adddn, $record);

    if($addProcess){
       return true;
    } else {
       return false;
    }
}

The group gets added however after sometime the group gets removed from LDAP.

What could cases this action ?

4

0 回答 0