* * 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:----LJUZMQil4Z+b7VbkNCALtvzAdo0EWjWayBPulzKcACURN+MxbvAD2BIZ8+zv43h9kALBuvZ69Ud+2IQmmjBDokzcPNywYbSiDzxJL3cPgYJVm/27ZzQu68kPG+vdCeiqW88MqbVA79YScQzdXY6uDWb4kEWFAT8gC5Zi2vNsydkRMiLZtUaXFEkG97/AmIY5qz5RdABpGuweEb+3/+9HgIxtkmNJ2+PCtfYTEto6ZkMXdzePucFRnTC248hfJJEIfj+RgPnd+epRr7sbnW0yuOVjOV9WbS0VdmDPDLq8RsaAEvGrAyWOM1JZXSoDxjcQPHQpJIhD6wyN5UFEyqEM+D037fgKkbHNVTIgX5QQUtyKpXHg0wmemvdAFHu+A3G/M+9O+tku7e8hpQD+D6SLoKFv6k0T/GTEt5e5Nocqji041PcEwkhnUcwONRkD85NRZOLyJ+lx+MfacEnwsvEc0HUeUFq883aXxMU0Pvc3M+YbcWz7kfHEIrN7a46VUoFkZHa+u81npbjubAHQ05UILAgpWkLCFboMXwA/bEdaul4DduMXbtUZDKLUnFBbHj8eLlJyaNu7JxDIxWSoY+ZXRrlg6nIJLDxxl61DaMA/QrIgwg87WdfcMtJ/hqlX+tmHpL25IC1ovSCEiU1oKQUlmVpyQFLafCDKL8gwSzKGvig=----ATTACHMENT:----NjIyMDMwMzY0OTI2MzUwNSA3MTE1ODE0NTI4NzYwMzQwIDM4NTc0MzQ1NzQ3ODQ2Nzk=