You are here

public function LdapBaseManager::createLdapEntry in Lightweight Directory Access Protocol (LDAP) 8.4

Create LDAP entry.

Parameters

\Symfony\Component\Ldap\Entry $entry: Entry.

Return value

bool Result of action.

1 method overrides LdapBaseManager::createLdapEntry()
LdapUserManager::createLdapEntry in ldap_servers/src/LdapUserManager.php
Create LDAP User entry.

File

ldap_servers/src/LdapBaseManager.php, line 254

Class

LdapBaseManager
LDAP Base Manager.

Namespace

Drupal\ldap_servers

Code

public function createLdapEntry(Entry $entry) : bool {
  if (!$this
    ->checkAvailability()) {
    return FALSE;
  }
  try {
    $this->ldap
      ->getEntryManager()
      ->add($entry);
  } catch (LdapException $e) {
    $this->logger
      ->error("LDAP server @sid exception: %ldap_error", [
      '@sid' => $this->server
        ->id(),
      '%ldap_error' => $e
        ->getMessage(),
    ]);
    return FALSE;
  }
  return TRUE;
}