73 if (isset(
$config[
'ldap_host'])) {
76 if (isset(
$config[
'ldap_port'])) {
79 if (isset(
$config[
'ldap_bind_user'])) {
82 if (isset(
$config[
'ldap_bind_pwd'])) {
85 if (isset(
$config[
'userid_attribute'])) {
88 if (isset(
$config[
'ldap_search_base_dn'])) {
91 if (isset(
$config[
'ldap_search_filter'])) {
94 if (isset(
$config[
'ldap_search_attribute'])) {
97 if (isset(
$config[
'new_attribute_name'])) {
111 $config[
'ldap_search_base_dn'],
113 $config[
'ldap_search_attribute'],
118 parent::__construct(
$config, $reserved);
121 $this->search_attributes = $this->config->getArrayize(
'attributes', array());
122 if (empty($this->search_attributes)) {
123 $new_attribute = $this->config->getString(
'attribute.new',
'');
124 $this->search_attributes[$new_attribute] = $this->config->getString(
'search.attribute');
126 $this->search_filter = $this->config->getString(
'search.filter');
129 $this->attr_policy = $this->config->getString(
'attribute.policy',
'merge');
141 assert(array_key_exists(
'Attributes',
$request));
147 $arrSearch = array();
148 $arrReplace = array();
150 $arrSearch[] =
'%'.$attr.
'%';
152 if (strlen($val[0]) > 0) {
160 $filter = str_replace($arrSearch, $arrReplace, $this->search_filter);
162 if (strpos($filter,
'%') !==
false) {
164 $this->search_filter.
')');
168 if (!in_array($this->attr_policy, array(
'merge',
'replace',
'add'),
true)) {
170 "'replace' or 'add'.");
184 $entries =
$ldap->searchformultiple(
187 array_values($this->search_attributes),
196 foreach ($entries as $entry) {
197 foreach ($this->search_attributes as
$target =>
$name) {
206 if (isset($entry[
$name])) {
207 unset($entry[$name][
'count']);
209 foreach (array_values($entry[$name]) as $value) {
210 if ($this->attr_policy ===
'merge') {
211 if (!in_array($value,
$attributes[$target],
true)) {
__construct($config, $reserved)
Initialize this filter.
foreach($paths as $path) $request
process(&$request)
Add attributes from an LDAP server.
static escape_filter_value($values=array(), $singleValue=true)
Borrowed function from PEAR:LDAP.
if(array_key_exists('yes', $_REQUEST)) $attributes
getLdap()
Getter for the LDAP connection object.