Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 778 → Rev 779

/web/acc/admin/lib/alcasar/freeradius/ldapconfig.php
14,14 → 14,15
if ($instanceName!== null)
$this->instanceName = $instanceName;
// LDAP setting
$this->_items['protocol'] = 'ldap://';
$this->_items['protocol'] = 'ldap';
$this->_items['host'] = 'test';
$this->_items['server'] = $this->_items['protocol'].$this->_items['host'];
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
$this->_items['port'] = '389';//not use yet (689 = ldaps)
$this->_items['identity'] = '';
$this->_items['password'] = '';
$this->_items['basedn'] = 'dc=example,dc=com';
$this->_items['filter'] = '(uid=%{Stripped-User-Name:-%{User-Name}})';
$this->_items['uid'] = 'uid';
$this->_items['filter'] = "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
$this->_items['base_filter'] = '';
$this->_items['ldap_connections_number'] = '5';
$this->_items['timeout'] = '4';
70,7 → 71,43
}
public function __set($attr, $value){// to set an $item
if (array_key_exists($attr, $this->_items)){
$this->_items[$attr] = $value;
switch ($attr){
case "protocol":
$this->_items['protocol'] = $value;
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
break;
case "host":
$this->_items['host'] = $value;
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
break;
case "server":
// extract protocole & host
$tmp = explode("://",$value,2);
if (count($tmp) == 2){
$this->_items['protocol'] = $tmp[0];
$this->_items['host'] = $tmp[1];
} else {
$this->_items['protocol'] = 'ldap';
$this->_items['host'] = $tmp[1];
}
$this->_items['server'] = $this->_items['protocol'].'://'.$this->_items['host'];
break;
case "uid":
$this->_items['uid'] = $value;
$this->_items['filter'] = "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
break;
case "filter":
// extract uid
if (preg_match('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`',$value)){
$this->_items['uid'] = preg_replace('`^[\(]([\sa-zA-Z0-9_-]*)=\%\{Stripped\-User\-Name:\-\%\{User-Name\}\}\)`','$1',$value);
} else {
$this->_items['uid'] = 'uid';
}
$this->_items['filter'] = "($this->_items['uid']=%{Stripped-User-Name:-%{User-Name}})";
break;
default:
$this->_items[$attr] = $value;
}
} elseif (array_key_exists($attr, $this->_tls)){
$this->_tls[$attr] = $value;
}