public function addDcIfNotExist($dn, $name) { if (!$this->ldap->isEntityExist($dn)) { $data = array(); $data['dc'] = $name; $data['o'] = $name; $data['objectclass'] = array('top', 'organization', 'dcObject'); $this->ldap->add($dn, $data); $this->logger->info("Created Dc:'" . $dn . "''"); } }
public function delete(User $user) { $dn = 'uid=' . $user->getUsername() . ',ou=users,' . $this->baseDn; if ($this->client->isEntityExist($dn)) { $this->client->delete($dn); } foreach ($user->getServices() as $service) { $dn = 'uid=' . $user->getUsername() . ',ou=users,dc=' . $service->getName() . ',' . $this->baseDn; if ($this->client->isEntityExist($dn)) { $this->client->delete($dn); } } }