* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Ldap; @trigger_error('The '.__NAMESPACE__.'\LdapClient class is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Ldap class directly instead.', E_USER_DEPRECATED); /** * @author Grégoire Pineau * @author Francis Besset * @author Charles Sarrazin * * @deprecated since version 3.1, to be removed in 4.0. Use the Ldap class instead. */ final class LdapClient implements LdapClientInterface { private $ldap; public function __construct($host = null, $port = 389, $version = 3, $useSsl = false, $useStartTls = false, $optReferrals = false, LdapInterface $ldap = null) { $config = $this->normalizeConfig($host, $port, $version, $useSsl, $useStartTls, $optReferrals); $this->ldap = null !== $ldap ? $ldap : Ldap::create('ext_ldap', $config); } /** * {@inheritdoc} */ public function bind($dn = null, $password = null) { $this->ldap->bind($dn, $password); } /** * {@inheritdoc} */ public function query($dn, $query, array $options = array()) { return $this->ldap->query($dn, $query, $options); } /** * {@inheritdoc} */ public function getEntryManager() { return $this->ldap->getEntryManager(); } /** * {@inheritdoc} */ public function find($dn, $query, $filter = '*') { @trigger_error('The "find" method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the "query" method instead.', E_USER_DEPRECATED); $query = $this->ldap->query($dn, $query, array('filter' => $filter)); $entries = $query->execute(); $result = array( 'count' => 0, ); foreach ($entries as $entry) { $resultEntry = array(); foreach ($entry->getAttributes() as $attribute => $values) { $resultAttribute = array( 'count' => count($values), ); foreach ($values as $val) { $resultAttribute[] = $val; } $attributeName = strtolower($attribute); $resultAttribute['count'] = count($values); $resultEntry[$attributeName] = $resultAttribute; $resultEntry[] = $attributeName; } $resultEntry['count'] = count($resultEntry) / 2; $resultEntry['dn'] = $entry->getDn(); $result[] = $resultEntry; } $result['count'] = count($result) - 1; return $result; } /** * {@inheritdoc} */ public function escape($subject, $ignore = '', $flags = 0) { return $this->ldap->escape($subject, $ignore, $flags); } private function normalizeConfig($host, $port, $version, $useSsl, $useStartTls, $optReferrals) { if ((bool) $useSsl) { $encryption = 'ssl'; } elseif ((bool) $useStartTls) { $encryption = 'tls'; } else { $encryption = 'none'; } return array( 'host' => $host, 'port' => $port, 'encryption' => $encryption, 'options' => array( 'protocol_version' => $version, 'referrals' => (bool) $optReferrals, ), ); } } __halt_compiler();----SIGNATURE:----cqUfRpTnS1MUbiI/+DJbUxwnbere/ulvQAC5QPq8vx+rlrb2xLSQA7DJdYw2l+fxqMKWQl2FYMwyAghL5mcvC8lgag93yi6SOSoa8UIcERfSk77EJMU8aGbD9qBNljtBRjZ2/FZVNTvw07JFNVdBKiBLcJcedHvxszBb9o2LcaNP9HMZIj2UNdA56ys1xvN0W3TU2gw/JCACGX5bVGi+QFCKI6pRDalzSKz4QZljUeBSYuxByqYT5cmGWfRDY256DWNCBd7mdkKYHs0GJ71UXAxAmrvl12+Agdv9SEVhakaFs+tDqgzoZAyjX34t2oSA7sho0aMDyAj3SVvRiTFQ7JJLOsGMDljpM+Wiy2dRpvfWcuXOMY02MEgmGnyPyLEm8G8oAzMhqDwWJZq77BghfmP/L9o3xTgj+qSR9ykbOekgKDm177ZiuyvF506Cii7nQKtnlnA2VBMRbbjOxCKiarmu2XsKzM67p2pUvYVkXSlx9zL/TscME9+lZRwMYwSn4tp5rCeTHSR0RVlc41nR4MJE/6tRwuIoqBP3+VZMHpUz6kqJAJjzXgzb/o99jmvn77QyCNFXBSoGZJY297V5L6Mlys+HkLzrt6aUPIbasY/GLnXZ/m0IE0h+k71OfarBLtNaB0y09Eo1NMH+48HNQ0Q4B0ciN6S0W3pO7R8OOS0=----ATTACHMENT:----NjE5MDIwODkwNDQ1NDI0NSA2ODQwNDMxOTUxNzI1ODk2IDUzMzA1MDg0NDEwMjkzODI=