Checks the authsource, if defined, for configuration values
to the LDAP server. Then sets up the LDAP connection for the
instance/object and stores everything in class members.
public __construct ( array &$config, $reserved ) | ||
$config | array | |
$reserved |
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { // For backwards compatibility, check for old config names if (isset($config['ldap_host'])) { $config['ldap.hostname'] = $config['ldap_host']; } if (isset($config['ldap_port'])) { $config['ldap.port'] = $config['ldap_port']; } if (isset($config['ldap_bind_user'])) { $config['ldap.username'] = $config['ldap_bind_user']; } if (isset($config['ldap_bind_pwd'])) { $config['ldap.password'] = $config['ldap_bind_pwd']; } if (isset($config['userid_attribute'])) { $config['attribute.username'] = $config['userid_attribute']; } if (isset($config['ldap_search_base_dn'])) { $config['ldap.basedn'] = $config['ldap_search_base_dn']; } if (isset($config['ldap_search_filter'])) { $config['search.filter'] = $config['ldap_search_filter']; } if (isset($config['ldap_search_attribute'])) { $config['search.attribute'] = $config['ldap_search_attribute']; } if (isset($config['new_attribute_name'])) { $config['attribute.new'] = $config['new_attribute_name']; } // Remove the old config names unset($config['ldap_host'], $config['ldap_port'], $config['ldap_bind_user'], $config['ldap_bind_pwd'], $config['userid_attribute'], $config['ldap_search_base_dn'], $config['ldap_search_filter'], $config['ldap_search_attribute'], $config['new_attribute_name']); // Now that we checked for BC, run the parent constructor parent::__construct($config, $reserved); // Get filter specific config options $this->new_attribute = $this->config->getString('attribute.new'); $this->search_attribute = $this->config->getString('search.attribute'); $this->search_filter = $this->config->getString('search.filter'); }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { /* * For backwards compatibility, check for old config names * @TODO Remove after 2.0 */ if (isset($config['ldap_host'])) { $config['ldap.hostname'] = $config['ldap_host']; } if (isset($config['ldap_port'])) { $config['ldap.port'] = $config['ldap_port']; } if (isset($config['ldap_bind_user'])) { $config['ldap.username'] = $config['ldap_bind_user']; } if (isset($config['ldap_bind_pwd'])) { $config['ldap.password'] = $config['ldap_bind_pwd']; } if (isset($config['userid_attribute'])) { $config['attribute.username'] = $config['userid_attribute']; } if (isset($config['ldap_search_base_dn'])) { $config['ldap.basedn'] = $config['ldap_search_base_dn']; } if (isset($config['ldap_search_filter'])) { $config['search.filter'] = $config['ldap_search_filter']; } if (isset($config['ldap_search_attribute'])) { $config['search.attribute'] = $config['ldap_search_attribute']; } if (isset($config['new_attribute_name'])) { $config['attribute.new'] = $config['new_attribute_name']; } /* * Remove the old config names * @TODO Remove after 2.0 */ unset($config['ldap_host'], $config['ldap_port'], $config['ldap_bind_user'], $config['ldap_bind_pwd'], $config['userid_attribute'], $config['ldap_search_base_dn'], $config['ldap_search_filter'], $config['ldap_search_attribute'], $config['new_attribute_name']); // Now that we checked for BC, run the parent constructor parent::__construct($config, $reserved); // Get filter specific config options $this->search_attributes = $this->config->getArrayize('attributes', array()); if (empty($this->search_attributes)) { $new_attribute = $this->config->getString('attribute.new', ''); $this->search_attributes[$new_attribute] = $this->config->getString('search.attribute'); } $this->search_filter = $this->config->getString('search.filter'); // get the attribute policy $this->attr_policy = $this->config->getString('attribute.policy', 'merge'); }