/**
     */
    public function testUserGroupCreate()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new UserGroup($this->savdb);
    	$localobject->initAsSpecimen();
    	$result=$localobject->create($user);

    	$this->assertLessThan($result, 0);
    	print __METHOD__." result=".$result."\n";
    	return $result;
    }
Exemple #2
0
/*
 * Test de la connexion
 */
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
    $butlabel = $langs->trans("LDAPTestSynchroGroup");
    $testlabel = 'testgroup';
    $key = $conf->global->LDAP_KEY_GROUPS;
    $dn = $conf->global->LDAP_GROUP_DN;
    $objectclass = $conf->global->LDAP_GROUP_OBJECT_CLASS;
    show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
}
if (function_exists("ldap_connect")) {
    if ($_GET["action"] == 'testgroup') {
        // Creation objet
        $object = new UserGroup($db);
        $object->initAsSpecimen();
        // Test synchro
        $ldap = new Ldap();
        $result = $ldap->connect_bind();
        if ($result > 0) {
            $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();
            }
            $result1 = $ldap->delete($dn);
            // To be sure to delete existing records
            $result2 = $ldap->add($dn, $info, $user);
            // Now the test
            $result3 = $ldap->delete($dn);