LdapConfiguration.php in Lightweight Directory Access Protocol (LDAP) 8.3
File
ldap_user/src/Helper/LdapConfiguration.php
View source
<?php
namespace Drupal\ldap_user\Helper;
use Drupal\ldap_servers\LdapUserAttributesInterface;
class LdapConfiguration implements LdapUserAttributesInterface {
public static function getAllEvents() {
return [
self::EVENT_CREATE_DRUPAL_USER,
self::EVENT_SYNC_TO_DRUPAL_USER,
self::EVENT_CREATE_LDAP_ENTRY,
self::EVENT_SYNC_TO_LDAP_ENTRY,
self::EVENT_LDAP_ASSOCIATE_DRUPAL_USER,
];
}
public static function provisionsDrupalEvents() {
return [
self::EVENT_CREATE_DRUPAL_USER => t('On Drupal User Creation'),
self::EVENT_SYNC_TO_DRUPAL_USER => t('On Sync to Drupal User'),
];
}
public static function provisionsDrupalAccountsFromLdap() {
if (\Drupal::config('ldap_user.settings')
->get('drupalAcctProvisionServer') && count(array_filter(array_values(\Drupal::config('ldap_user.settings')
->get('drupalAcctProvisionTriggers')))) > 0) {
return TRUE;
}
else {
return FALSE;
}
}
public static function provisionAvailableToLdap($trigger) {
if (\Drupal::config('ldap_user.settings')
->get('ldapEntryProvisionTriggers')) {
return in_array($trigger, \Drupal::config('ldap_user.settings')
->get('ldapEntryProvisionTriggers'));
}
else {
return FALSE;
}
}
public static function provisionAvailableToDrupal($trigger) {
if (\Drupal::config('ldap_user.settings')
->get('drupalAcctProvisionTriggers')) {
return in_array($trigger, \Drupal::config('ldap_user.settings')
->get('drupalAcctProvisionTriggers'));
}
else {
return FALSE;
}
}
}
Classes
Name |
Description |
LdapConfiguration |
Helper class to collect trivial lists of elements for events and users. |