* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Ldap\Adapter\ExtLdap; use Symfony\Component\Ldap\Adapter\EntryManagerInterface; use Symfony\Component\Ldap\Adapter\RenameEntryInterface; use Symfony\Component\Ldap\Entry; use Symfony\Component\Ldap\Exception\LdapException; use Symfony\Component\Ldap\Exception\NotBoundException; /** * @author Charles Sarrazin * @author Bob van de Vijver */ class EntryManager implements EntryManagerInterface, RenameEntryInterface { private $connection; public function __construct(Connection $connection) { $this->connection = $connection; } /** * {@inheritdoc} */ public function add(Entry $entry) { $con = $this->getConnectionResource(); if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) { throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con))); } return $this; } /** * {@inheritdoc} */ public function update(Entry $entry) { $con = $this->getConnectionResource(); if (!@ldap_modify($con, $entry->getDn(), $entry->getAttributes())) { throw new LdapException(sprintf('Could not update entry "%s": %s.', $entry->getDn(), ldap_error($con))); } } /** * {@inheritdoc} */ public function remove(Entry $entry) { $con = $this->getConnectionResource(); if (!@ldap_delete($con, $entry->getDn())) { throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con))); } } /** * {@inheritdoc} */ public function rename(Entry $entry, $newRdn, $removeOldRdn = true) { $con = $this->getConnectionResource(); if (!@ldap_rename($con, $entry->getDn(), $newRdn, null, $removeOldRdn)) { throw new LdapException(sprintf('Could not rename entry "%s" to "%s": %s.', $entry->getDn(), $newRdn, ldap_error($con))); } } /** * Get the connection resource, but first check if the connection is bound. */ private function getConnectionResource() { // If the connection is not bound, throw an exception. Users should use an explicit bind call first. if (!$this->connection->isBound()) { throw new NotBoundException('Query execution is not possible without binding the connection first.'); } return $this->connection->getResource(); } } __halt_compiler();----SIGNATURE:----WzorV94auTCv6Lv4vcIlEfSQefqtPXn3OLRIc8nqMJl2BnlZ7KcsM0Wh4HM+DBhXBvTAa0o9RaXiSGfnoI+8ftNeixyPuuvxkvVXiHkwaWiKNUwighmAbiB421ee5GIokXmx6aGDsEeuolwhviSj7yIHTUuDqbfIsCFF3hxR861RikB8oMwa6k+/VUiusxefSP001BfVvhGwtpfuCC4zWPCpVF0qg8fTR5doGJgEwGELhGxzlYtWgVy5OZ4Gr5lZYfbDqB/wqACxKhlS8CaEb3O65skPv0s4t+WrWOalIYr/rwh+7y/18/zBBqWZKJKUUWvhlW7PfHyHq4/ImBpdUeMp6QvrWjMBg8ycuia5FxJ2R6CFOTvhm0b84I4iqARZF7cyIqMVo2gXwOl5GED/L+16CvWgMyihKDciGlq5TM6o6HvKj3FVtGSp152xo7IzBlIFpJCG6sgp2Kjs+jRYBD1wx8ALLSeXI7Ahx+k7TF30XupAkGWrUiTEXAO3ovgTGU39F3T9cUafWdWJEqv4+9NIx1koWmNcEzFGOnRstZ+9OOMeVLukD3TDJ+sgT2w005TWX1+E1aIOWWGRo7nCSEfGPGASajjoRkTytXhFvcCCSVAZt0mBnaC7wkcNRI1rNVN+SThHDL9lIHblKzVRHmnfNumqOT2KZZQ32Yh3/RQ=----ATTACHMENT:----Mzc3MDg4NjExMDEzODYzIDkyMzg3MzUyOTI5NDEwNjUgMTU4MjcxNjUyNzc0ODkyOA==