You are here

private function FieldProvider::addBaseProperties in Lightweight Directory Access Protocol (LDAP) 8.4

Add base properties.

1 call to FieldProvider::addBaseProperties()
FieldProvider::loadAttributes in ldap_user/src/FieldProvider.php
LDAP attributes to alter.

File

ldap_user/src/FieldProvider.php, line 282

Class

FieldProvider
Provides the basic and required fields needed for user mappings.

Namespace

Drupal\ldap_user

Code

private function addBaseProperties() : void {
  $fields = [
    '[property.name]' => 'Property: Username',
    '[property.mail]' => 'Property: Email',
  ];
  if ($this->server
    ->getPictureAttribute()) {
    $fields['[property.picture]'] = 'Property: Picture';
  }
  foreach ($fields as $key => $name) {
    $this->attributes[$key] = new Mapping($key, $name, FALSE, TRUE, [
      self::EVENT_CREATE_DRUPAL_USER,
      self::EVENT_SYNC_TO_DRUPAL_USER,
    ], 'ldap_servers', 'ldap_user');
  }
  $this->attributes['[property.name]']
    ->setLdapAttribute($this
    ->addTokens($this->server
    ->getAuthenticationNameAttribute()));
  if ($this->server
    ->getMailTemplate()) {
    $this->attributes['[property.mail]']
      ->setLdapAttribute($this->server
      ->getMailTemplate());
  }
  else {
    $this->attributes['[property.mail]']
      ->setLdapAttribute($this
      ->addTokens($this->server
      ->getMailAttribute()));
  }
  if ($this->server
    ->getPictureAttribute()) {
    $this->attributes['[property.picture]']
      ->setLdapAttribute($this
      ->addTokens($this->server
      ->getPictureAttribute()));
  }
}