public function setUp()
 {
     $connect = new Connection(LDAP_HOST, LDAP_PORT);
     $connect->identify(LDAP_USER, LDAP_PASSWORD);
     $client = $connect->connect();
     $client->setBaseDn(LDAP_BASE_DN);
     try {
         EntityManager::addEntityManager('default', $client);
     } catch (\InvalidArgumentException $e) {
     }
     $this->em = EntityManager::getEntityManager();
 }
 public function setUp()
 {
     $connect = new Connection(LDAP_HOST, LDAP_PORT);
     $connect->identify(LDAP_USER, LDAP_PASSWORD);
     $client = $connect->connect();
     $client->setBaseDn(LDAP_BASE_DN);
     try {
         EntityManager::addEntityManager('default', $client);
     } catch (\InvalidArgumentException $e) {
     }
     $this->repository = EntityManager::getEntityManager()->getRepository('\\OpenLdapObject\\Tests\\Manager\\People');
 }
 public function setUp()
 {
     $connect = new Connection(LDAP_HOST, LDAP_PORT);
     $connect->identify(LDAP_USER, LDAP_PASSWORD);
     $client = $connect->connect();
     $client->setBaseDn(LDAP_BASE_DN);
     try {
         EntityManager::addEntityManager('default', $client);
     } catch (\InvalidArgumentException $e) {
     }
     $this->em = EntityManager::getEntityManager();
     $this->entityCollection = new EntityCollection(EntityCollection::DN, $this->em->getRepository('\\OpenLdapObject\\Tests\\Manager\\People'), array('uid=mdupont,ou=people,dc=example,dc=com', 'uid=pdeparis,ou=people,dc=example,dc=com'));
 }
 private function initEntityManager($hostname, $port, $base_dn, $dn, $password)
 {
     $port = $port ? $port : self::DEFAULT_PORT;
     $connect = new Connection($hostname, $port);
     if ($dn && $password) {
         $connect->identify($dn, $password);
     }
     $client = $connect->connect();
     $client->setBaseDn($base_dn);
     try {
         \OpenLdapObject\Manager\EntityManager::addEntityManager('default', $client, true);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
 public function boot()
 {
     parent::boot();
     if (!is_null($this->container->getParameter('ldap_object.host'))) {
         $connect = new Connection($this->container->getParameter('ldap_object.host'), $this->container->getParameter('ldap_object.port'));
         if (!is_null($this->container->getParameter('ldap_object.dn')) && !is_null($this->container->getParameter('ldap_object.password'))) {
             $connect->identify($this->container->getParameter('ldap_object.dn'), $this->container->getParameter('ldap_object.password'));
         }
         $client = $connect->connect();
         $client->setBaseDn($this->container->getParameter('ldap_object.base_dn'));
         try {
             EntityManager::addEntityManager('default', $client);
         } catch (Exception $e) {
             // Nothing
         }
     }
 }
 public function setUp()
 {
     $connection = new Connection(LDAP_HOST, LDAP_PORT);
     $connection->identify(LDAP_USER, LDAP_PASSWORD);
     $this->client = $connection->connect();
 }
 public function __construct(Connection $connection)
 {
     parent::__construct('Unable to connect to ' . $connection->getHostname() . ':' . $connection->getPort());
 }
 public function __construct(Connection $connection)
 {
     parent::__construct('Unable to identify to ' . $connection->getHostname() . ':' . $connection->getPort() . ' with username ' . $connection->getUsername() . ' and password');
 }
示例#9
0
 /**
  * @expectedException OpenLdapObject\Exception\BadIdentificationException
  */
 public function testBadIdentify()
 {
     $connection = new Connection(LDAP_HOST, LDAP_PORT);
     $connection->identify(LDAP_BAD_USER, LDAP_BAD_PASSWORD);
     $connection->connect();
 }