Browse Source

aggiunta segnalazione errore connessione ldap

master
Andrea Cimbalo 11 years ago
parent
commit
0b0dd657a7
2 changed files with 20 additions and 1 deletions
  1. +14
    -1
      lilikuser.php
  2. +6
    -0
      user.php

+ 14
- 1
lilikuser.php View File

@ -12,7 +12,12 @@ class LdapAdapter{
function __construct($host, $port, $user, $pass){
$this->conn = ldap_connect($host,$port);
ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_bind($this->conn, $user, $pass);
$this->bind_status = ldap_bind($this->conn, $user, $pass);
}
function get_bind_status(){
return $this->bind_status;
}
function bind($host, $port, $user, $pass){
@ -245,6 +250,10 @@ abstract class pippo{
$this->la=new LdapAdapter($HOST, $PORT, $LOGIN_DN, $LOGIN_PASS);
}
function get_bind_status(){
return $this->la->get_bind_status();
}
function get_attr($attr){
foreach($this->adapters as $adapter){
$result=$adapter->get_attr($this->la, $this->id, $attr);
@ -358,6 +367,10 @@ class LilikUser extends pippo{
return $this->status('admin');
}
function is_binded(){
}
function enable($service){
if (array_key_exists($service, $this->_flag)){
return $this->set_attr($this->_flag[$service], 'TRUE');


+ 6
- 0
user.php View File

@ -23,6 +23,12 @@ include 'lilikuser.php';
$u=new LilikUser($_SESSION['username']);
if (!$u->get_bind_status()){
$response['error']='Errore di connessione a ldap';
echo json_encode($response);
exit;
}
#bind ldap or exit
$loggedin=$u->check_password($_SESSION['password']);
$response['loggedin']=$loggedin;


Loading…
Cancel
Save