Skip to content

Commit 97d9cee

Browse files
committed
Improved BC layer for the Ldap component
1 parent 728bb0f commit 97d9cee

File tree

5 files changed

+51
-51
lines changed

5 files changed

+51
-51
lines changed

src/Symfony/Component/Ldap/BaseLdapInterface.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/Symfony/Component/Ldap/LdapClient.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ public function bind($dn = null, $password = null)
4444
$this->ldap->bind($dn, $password);
4545
}
4646

47+
/**
48+
* {@inheritdoc}
49+
*/
50+
public function query($dn, $query, array $options = array())
51+
{
52+
return $this->ldap->query($dn, $query, $options);
53+
}
54+
55+
/**
56+
* {@inheritdoc}
57+
*/
58+
public function getEntryManager()
59+
{
60+
return $this->ldap->getEntryManager();
61+
}
62+
4763
/**
4864
* {@inheritdoc}
4965
*/

src/Symfony/Component/Ldap/LdapClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
*
2222
* @deprecated You should use LdapInterface instead
2323
*/
24-
interface LdapClientInterface extends BaseLdapInterface
24+
interface LdapClientInterface extends LdapInterface
2525
{
26-
/*
26+
/**
2727
* Find a username into ldap connection.
2828
*
2929
* @param string $dn

src/Symfony/Component/Ldap/LdapInterface.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,28 @@
1313

1414
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
1515
use Symfony\Component\Ldap\Adapter\QueryInterface;
16+
use Symfony\Component\Ldap\Exception\ConnectionException;
1617

1718
/**
1819
* Ldap interface.
1920
*
2021
* @author Charles Sarrazin <charles@sarraz.in>
2122
*/
22-
interface LdapInterface extends BaseLdapInterface
23+
interface LdapInterface
2324
{
2425
const ESCAPE_FILTER = 0x01;
2526
const ESCAPE_DN = 0x02;
2627

28+
/**
29+
* Return a connection bound to the ldap.
30+
*
31+
* @param string $dn A LDAP dn
32+
* @param string $password A password
33+
*
34+
* @throws ConnectionException If dn / password could not be bound.
35+
*/
36+
public function bind($dn = null, $password = null);
37+
2738
/**
2839
* Queries a ldap server for entries matching the given criteria.
2940
*
@@ -39,4 +50,15 @@ public function query($dn, $query, array $options = array());
3950
* @return EntryManagerInterface
4051
*/
4152
public function getEntryManager();
53+
54+
/**
55+
* Escape a string for use in an LDAP filter or DN.
56+
*
57+
* @param string $subject
58+
* @param string $ignore
59+
* @param int $flags
60+
*
61+
* @return string
62+
*/
63+
public function escape($subject, $ignore = '', $flags = 0);
4264
}

src/Symfony/Component/Ldap/Tests/LdapClientTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ public function testLdapEscape()
5454
$this->client->escape('foo', 'bar', 'baz');
5555
}
5656

57+
public function testLdapQuery()
58+
{
59+
$this->ldap
60+
->expects($this->once())
61+
->method('query')
62+
->with('foo', 'bar', array('baz'))
63+
;
64+
$this->client->query('foo', 'bar', array('baz'));
65+
}
66+
5767
public function testLdapFind()
5868
{
5969
$collection = $this->getMock(CollectionInterface::class);

0 commit comments

Comments
 (0)