Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 778 → Rev 779

/web/acc/admin/ldap.php
81,11 → 81,11
//Lecture du fichier /etc/raddb/modules/ldap
$ldap = new ldapConfig();
$ldap->load(ALCASAR_RADIUS_MODULE_LDAP);
$ldap_server = $ldap->server;
$ldap_server = $ldap->host; // others options only in alcasar 3.x ($ldap->server)
$ldap_identity = $ldap->identity;
$ldap_password = $ldap->password;
$ldap_basedn = $ldap->basedn;
$ldap_filter = $ldap->filter;
$ldap_filter = $ldap->uid;// others options only in alcasar 3.x ($ldap->filter)
$ldap_base_filter = $ldap->base_filter;
 
 
/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;
}
/web/acc/admin/update_ldap.php
108,11 → 108,13
$ldap = new ldapConfig();
$ldap->load(ALCASAR_RADIUS_MODULE_LDAP);
// mise à jours des données
$ldap->server = $ldap_server;
//$ldap->server = $ldap_server;
$ldap->host = $ldap_server;
$ldap->identity = $ldap_identity;
$ldap->password = $ldap_password;
$ldap->basedn = $ldap_basedn;
$ldap->filter = $ldap_filter;
//$ldap->filter = $ldap_filter;
$ldap->uid = $ldap_filter;
$ldap->base_filter = $ldap_base_filter;
//sauvegarde du fichier /etc/raddb/modules/ldap
$ldap->save(ALCASAR_RADIUS_MODULE_LDAP);