getSchemaFolder() public method

Get the location where the schema definitions exist.
public getSchemaFolder ( ) : string
return string
 function let(LdapConnectionInterface $connection, LdapObject $rootdse)
 {
     $domain = new DomainConfiguration('example.local');
     $domain->setUseTls(true);
     $connection->getConfig()->willReturn($domain);
     $connection->getRootDse()->willReturn($rootdse);
     $config = new Configuration();
     $this->parser = new SchemaYamlParser($config->getSchemaFolder());
     $this->schema = $this->parser->parse('ad', 'user');
 }
 function let()
 {
     $this->filter = new FilterBuilder();
     $config = new Configuration();
     $parser = new SchemaYamlParser($config->getSchemaFolder());
     $this->schema = $parser->parse('ad', 'user');
     $this->collection = new OperatorCollection();
     $this->collection->addLdapObjectSchema($this->schema);
     $this->collection->addLdapObjectSchema($parser->parse('ad', 'ou'));
     $this->beConstructedThrough('getInstance', [$this->schema, $this->collection, AttributeConverterInterface::TYPE_SEARCH_TO]);
 }
 public function let(LdapConnectionInterface $connection)
 {
     $config = new Configuration();
     $config->setCacheType('none');
     $connection->execute(Argument::any())->willReturn($this->ldapEntries);
     $connection->getConfig()->willReturn(new DomainConfiguration('example.local'));
     $cache = CacheFactory::get($config->getCacheType(), $config->getCacheOptions());
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $dispatcher = new SymfonyEventDispatcher();
     $schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
     $this->beConstructedWith($schemaFactory->get('ad', 'user'), $connection);
 }
 function let(LdapConnectionInterface $connection)
 {
     $config = new Configuration();
     $domain = new DomainConfiguration('example.com');
     $domain->setServers(['example'])->setBaseDn('dc=example,dc=com')->setLazyBind(true)->setPageSize(500);
     $connection->getConfig()->willReturn($domain);
     $config->setCacheType('none');
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $cache = CacheFactory::get($config->getCacheType(), []);
     $dispatcher = new SymfonyEventDispatcher();
     $schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
     $this->fb = new FilterBuilder();
     $this->schema = $schemaFactory;
     $this->objectSchema = $schema = new LdapObjectSchema('ad', 'user');
     $this->objectSchema->setFilter($this->fb->bAnd($this->fb->eq('objectCategory', 'person'), $this->fb->eq('objectClass', 'user')));
     $this->beConstructedWith($connection, $schemaFactory);
 }
 public function let(LdapConnectionInterface $connection)
 {
     $this->config = (new DomainConfiguration('example.com'))->setSchemaName('example');
     $this->config->setUseTls(true);
     $ldapObject = new LdapObject(['defaultNamingContext' => 'dc=example,dc=com'], ['*'], '', 'ad');
     $connection->getConfig()->willReturn($this->config);
     $connection->getRootDse()->willReturn($ldapObject);
     $config = new Configuration();
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $parserTest = SchemaParserFactory::get($config->getSchemaFormat(), __DIR__ . '/../../resources/schema');
     $cache = CacheFactory::get('none', []);
     $this->dispatcher = new SymfonyEventDispatcher();
     $this->schemaFactoryTest = new LdapObjectSchemaFactory($cache, $parserTest, $this->dispatcher);
     $this->schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $this->dispatcher);
     $this->attributes['unicodePwd'] = (new EncodeWindowsPassword())->toLdap('12345');
     $this->addOperation = (new AddOperation('foo'))->setDn("cn=somedude,dc=foo,dc=bar")->setAttributes($this->attributes);
     $this->beConstructedWith($connection, $this->schemaFactoryTest, $this->dispatcher);
 }
 function it_should_get_the_ldif_string_representation_in_the_context_of_a_type_and_a_schema(LdapConnectionInterface $connection, LdapObject $rootdse)
 {
     $domain = new DomainConfiguration('example.local');
     $domain->setUseTls(true);
     $connection->getConfig()->willReturn($domain);
     $connection->getRootDse()->willReturn($rootdse);
     $config = new Configuration();
     $parser = new SchemaYamlParser($config->getSchemaFolder());
     $schema = $parser->parse('ad', 'user');
     $dn = 'cn=foo,dc=foo,dc=bar';
     $this->beConstructedWith($dn);
     $this->setLdapObjectSchema($schema);
     $this->setLdapConnection($connection);
     $this->add('phoneNumber', '555-5555');
     $this->reset('lastName');
     $this->replace('firstName', 'bar');
     $this->delete('password', 'foo');
     $this->add('password', 'bar');
     $ldif = "dn: {$dn}\r\n" . "changetype: modify\r\n" . "add: telephoneNumber\r\n" . "telephoneNumber: 555-5555\r\n" . "-\r\n" . "delete: sn\r\n" . "-\r\n" . "replace: givenName\r\n" . "givenName: bar\r\n" . "-\r\n" . "delete: unicodePwd\r\n" . "unicodePwd: IgBmAG8AbwAiAA==\r\n" . "-\r\n" . "add: unicodePwd\r\n" . "unicodePwd: IgBiAGEAcgAiAA==\r\n" . "-\r\n";
     $this->toString()->shouldBeEqualTo($ldif);
 }
 function it_should_call_the_load_schema_event($dispatcher)
 {
     $config = new Configuration();
     $parser = SchemaParserFactory::get('yml', $config->getSchemaFolder());
     $cache = CacheFactory::get('none', []);
     new LdapObjectSchemaEvent(Event::LDAP_SCHEMA_LOAD, new LdapObjectSchema('ad', 'user'));
     $dispatcher->dispatch(Argument::type('\\LdapTools\\Event\\LdapObjectSchemaEvent'))->shouldBeCalled();
     $this->beConstructedWith($cache, $parser, $dispatcher);
     $this->get('ad', LdapObjectType::USER);
 }
Example #8
0
 function it_should_get_the_ldif_representation_in_the_context_of_a_type_and_schema(LdapConnectionInterface $connection, LdapObject $rootdse)
 {
     $domain = new DomainConfiguration('example.local');
     $domain->setUseTls(true);
     $connection->getConfig()->willReturn($domain);
     $connection->getRootDse()->willReturn($rootdse);
     $config = new Configuration();
     $parser = new SchemaYamlParser($config->getSchemaFolder());
     $schema = $parser->parse('ad', 'user');
     $this->beConstructedWith(null);
     $this->setLdapObjectSchema($schema);
     $this->setLdapConnection($connection);
     $this->setAttributes(['username' => 'John', 'password' => '12345']);
     $this->setLocation('ou=employees,dc=example,dc=local');
     $ldif = "dn: cn=John,ou=employees,dc=example,dc=local\r\n" . "changetype: add\r\n" . "cn: John\r\n" . "displayname: John\r\n" . "givenName: John\r\n" . "userPrincipalName: John@example.local\r\n" . "objectclass: top\r\n" . "objectclass: person\r\n" . "objectclass: organizationalPerson\r\n" . "objectclass: user\r\n" . "sAMAccountName: John\r\n" . "unicodePwd: IgAxADIAMwA0ADUAIgA=\r\n" . "userAccountControl: 512\r\n";
     $this->toString()->shouldBeEqualTo($ldif);
 }
 function let()
 {
     $config = new Configuration();
     $this->beConstructedWith($config->getSchemaFolder());
 }
Example #10
0
 function it_should_sort_results_for_multiple_aliases($connection)
 {
     $config = new Configuration();
     $domain = new DomainConfiguration('example.com');
     $domain->setServers(['example'])->setBaseDn('dc=example,dc=com')->setLazyBind(true)->setPageSize(500);
     $connection->getConfig()->willReturn($domain);
     $config->setCacheType('none');
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $cache = CacheFactory::get($config->getCacheType(), []);
     $dispatcher = new SymfonyEventDispatcher();
     $schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
     $ou = $schemaFactory->get('ad', 'ou');
     $container = $schemaFactory->get('ad', 'container');
     $filter = new OperatorCollection();
     $filter->addLdapObjectSchema($ou);
     $filter->addLdapObjectSchema($container);
     $this->operation->setFilter($filter);
     $this->operation->setAttributes([]);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(objectClass=organizationalUnit)';
     }))->shouldBeCalled()->willReturn($this->ous);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(objectCategory=container))';
     }))->shouldBeCalled()->willReturn($this->containers);
     $this->setOrderBy(['Name' => LdapQuery::ORDER['ASC'], 'ou.Description' => LdapQuery::ORDER['DESC']]);
     $this->getResult()->shouldHavePlaceKeyAndValue(0, 'name', 'Computers');
     $this->getResult()->shouldHavePlaceKeyAndValue(1, 'name', 'Employees');
     $this->getResult()->shouldHavePlaceKeyAndValue(2, 'name', 'Users');
     $this->getResult()->shouldHavePlaceKeyAndValue(3, 'name', 'West');
 }