示例#1
0
 function Valide($valid = '')
 {
     global $errs;
     if ($valid) {
         $param['cw'] = "WHERE idutilisateur=" . $_POST['iduser'];
         $req = new clResultQuery();
         $res = $req->Execute("Fichier", "getUtilisateurs", $param, "ResultQuery");
     } else {
         $param['password'] = $_POST['password'];
         $param['uid'] = $_POST['login'];
         $req = new clResultQuery();
         $res = $req->Execute("Fichier", "authUtilisateur", $param, "ResultQuery");
     }
     if ($res['uid'][0] == $_POST['login'] or $res['idutilisateur'][0] == $_POST['iduser'] and $_POST['iduser']) {
         $this->informations['password'] = XhamTools::chiffre($_POST['password']);
         $this->informations['type'] = "MySQLInt";
         $this->informations['nom'] = $res['nom'][0];
         $this->informations['prenom'] = $res['prenom'][0];
         $this->informations['pseudo'] = $res['uid'][0];
         $this->informations['mail'] = $res['mail'][0];
         $this->informations['iduser'] = $res['uid'][0];
         $param[cw] = "WHERE idutilisateur='" . $res['idutilisateur'][0] . "'";
         $req = new clResultQuery();
         $res = $req->Execute("Fichier", "getGroupesUtilisateur", $param, "ResultQuery");
         $groupes = $res['idgroupe'][0];
         for ($i = 1; isset($res['idutilisateur'][$i]); $i++) {
             $groupes .= "," . $res['idgroupe'][$i];
         }
         $this->informations['idgroupe'] = $groupes;
         return 1;
     }
 }
示例#2
0
 function Valide($noBind = '')
 {
     global $errs;
     $this->conn = ldap_connect(LDAP_HOST, LDAP_PORT);
     ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
     if (!$this->conn) {
         $errs->addErreur("clAuthLdap : Connexion impossible à l'annuaire LDAP.", 1);
     }
     $result = ldap_search($this->conn, LDAP_BASE, "(uid=" . $_POST['login'] . ")");
     $info = ldap_get_entries($this->conn, $result);
     if ($noBind) {
         $this->bindLDAP = 1;
     } else {
         $this->bindLDAP = @ldap_bind($this->conn, $info[0]['dn'], $_POST['password']);
     }
     if ($this->bindLDAP) {
         $result = ldap_search($this->conn, LDAP_BASE, "(uid=" . $_POST['login'] . ")");
         $info = ldap_get_entries($this->conn, $result);
         //$this->informations['ldapdata'] = $info ;
         $this->informations['password'] = XhamTools::chiffre($_POST['password']);
         $this->informations['type'] = "LDAP";
         $this->informations['nom'] = $info[0]["sn"][0];
         $this->informations['prenom'] = $info[0]["givenname"][0];
         $this->informations['iduser'] = $info[0]["uid"][0];
         $this->informations['pseudo'] = $info[0]["cn"][0];
         $this->informations['mail'] = $info[0]["mail"][0];
         $this->informations['tel'] = $info[0]["telephonenumber"];
         $this->informations['mob'] = $info[0]["mobile"];
         $this->informations['org'] = $this->getOrganisations($info[0]["chhatorganisation"]);
         $this->informations['equipes'] = $this->getEquipes($info[0]["chhatequipe"]);
         $results = ldap_search($this->conn, LDAP_BASE, "(&(memberUid=" . $_POST['login'] . ")(objectclass=mailgroup))");
         $infoGroupe = ldap_get_entries($this->conn, $results);
         //tableau des groupes (definis par ldap) pour l'user
         $this->informations['groupes'] = $this->getLdapGroupList($infoGroupe);
         $this->informations['idgroupe'] = $this->getGroupes($info[0]["uid"][0], $info[0]["chhatequipe"], $info[0]["chhatfonction"], $info[0]["chhatorganisation"], $infoGroupe);
         for ($i = 0; isset($info[0]["chhatfonction"][$i]); $i++) {
             $fonctions[$i] = $this->getCN($info[0]["chhatfonction"][$i]);
         }
         $this->informations['fonctions'] = $fonctions;
         for ($i = 0; isset($info[0]["chhatequipe"][$i]); $i++) {
             $services[$i] = $this->getCN($info[0]["chhatequipe"][$i]);
         }
         $this->informations['service'] = $services;
         // print affTab ( $info[0] ) ;
         // print affTab ( $info[0]["uid"] ) ;
         ldap_close($this->conn);
         return 1;
     } else {
     }
 }
示例#3
0
 function connect($valid = '')
 {
     global $errs;
     if ($valid || $this->xham->getMode() == 'manuel') {
         $param['cw'] = "WHERE idutilisateur=" . $_POST['iduser'];
         $res = $this->xham->Execute("Fichier", "getUtilisateurs", $param, "ResultQuery");
     } else {
         $param['password'] = $_POST['password'];
         $param['uid'] = $_POST['login'];
         $req = new clResultQuery();
         $res = $this->xham->Execute("Fichier", "authUtilisateur", $param, "ResultQuery");
     }
     if ($res['uid'][0] == $_POST['login'] or $res['idutilisateur'][0] == $_POST['iduser'] and $_POST['iduser']) {
         $this->informations['password'] = XhamTools::chiffre($_POST['password']);
         $this->informations['type'] = "MySQLInt";
         $this->informations['nom'] = $res['nom'][0];
         $this->informations['prenom'] = $res['prenom'][0];
         $this->informations['pseudo'] = $res['uid'][0];
         $this->informations['mail'] = $res['mail'][0];
         $this->informations['iduser'] = $res['uid'][0];
         $this->informations['fonctions'] = array();
         $this->informations['tel'] = '';
         $this->informations['mob'] = '';
         $this->informations['org'] = '';
         $this->informations['equipes'] = array();
         $this->informations['service'] = array();
         $this->informations['ip'] = $_SERVER['REMOTE_ADDR'];
         $this->informations['navigateur'] = substr($_SERVER["HTTP_USER_AGENT"], 0, 255);
         $this->informations['id'] = $res['idutilisateur'][0];
         $param['cw'] = "WHERE idutilisateur='" . $res['idutilisateur'][0] . "'";
         $res = $this->xham->Execute("Fichier", "getGroupesUtilisateur", $param, "ResultQuery");
         $groupes = $res['idgroupe'][0];
         for ($i = 1; isset($res['idutilisateur'][$i]); $i++) {
             $groupes .= "," . $res['idgroupe'][$i];
         }
         $this->informations['idgroupe'] = $groupes;
         return 1;
     }
 }
示例#4
0
 function connect($noBind = '', $manualUser = '')
 {
     $xm = $this->xham;
     if ($manualUser) {
         $login = $manualUser;
     } else {
         $login = $xm->getr('login');
     }
     $this->conne = ldap_connect(LDAP_HOST, LDAP_PORT);
     ldap_set_option($this->conne, LDAP_OPT_PROTOCOL_VERSION, 3);
     if (!$this->conne) {
         $xm->addErreur("clXhamUserLdap : Connexion impossible à l'annuaire LDAP.", 1);
     }
     $result = ldap_search($this->conne, LDAP_BASE, "(uid=" . $xm->getr('login') . ")");
     $info = ldap_get_entries($this->conne, $result);
     if (sizeof($info) <= 1) {
         return false;
     }
     if ($noBind) {
         $this->bindLDAP = 1;
     } elseif ($xm->getMode() == 'manuel' || $manualUser) {
         //whereAmI();
         $this->bindLDAP = @ldap_bind($this->conne, LDAP_DN, LDAP_PD);
     } else {
         $this->xham->errs->startCatch();
         $this->bindLDAP = @ldap_bind($this->conne, $info[0]['dn'], $xm->getr('password'));
         $this->xham->errs->stopCatch();
     }
     if ($this->bindLDAP) {
         $result = ldap_search($this->conne, LDAP_BASE, "(uid={$login})");
         $info = ldap_get_entries($this->conne, $result);
         $this->informations['password'] = XhamTools::chiffre($_POST['password']);
         $this->informations['type'] = "LDAP";
         $this->informations['nom'] = utf8_decode($info[0]["sn"][0]);
         $this->informations['prenom'] = utf8_decode($info[0]["givenname"][0]);
         $this->informations['iduser'] = $info[0]["uid"][0];
         $this->informations['pseudo'] = utf8_decode($info[0]["cn"][0]);
         $this->informations['mail'] = $info[0]["mail"][0];
         if (isset($info[0]["telephonenumber"])) {
             $this->informations['tel'] = $info[0]["telephonenumber"];
         } else {
             $this->informations['tel'] = "";
         }
         $this->informations['mob'] = isset($info[0]["mobile"]) ? $info[0]["mobile"] : '';
         $this->informations['org'] = XhamUserLdap::calcOrganisations($info[0]["chhatorganisation"]);
         $this->informations['equipes'] = XhamUserLdap::calcEquipes($info[0]["chhatequipe"]);
         $this->informations['ip'] = $_SERVER['REMOTE_ADDR'];
         $this->informations['navigateur'] = substr($_SERVER["HTTP_USER_AGENT"], 0, 255);
         $results = ldap_search($this->conne, LDAP_BASE, "(&(memberUid={$login})(objectclass=mailgroup))");
         $infoGroupe = ldap_get_entries($this->conne, $results);
         //tableau des groupes (definis par ldap) pour l'user
         $this->informations['groupes'] = XhamUserLdap::calcLdapGroupList($infoGroupe);
         $this->informations['idgroupe'] = $this->getGroupes($info[0]["uid"][0], $info[0]["chhatequipe"], $info[0]["chhatfonction"], $info[0]["chhatorganisation"], $infoGroupe);
         for ($i = 0; isset($info[0]["chhatfonction"][$i]); $i++) {
             $fonctions[$i] = XhamUserLdap::calcCN($info[0]["chhatfonction"][$i]);
         }
         $this->informations['fonctions'] = $fonctions;
         for ($i = 0; isset($info[0]["chhatequipe"][$i]); $i++) {
             $services[$i] = XhamUserLdap::calcCN($info[0]["chhatequipe"][$i]);
         }
         $this->informations['service'] = $services;
         ldap_close($this->conne);
         return true;
     } else {
         return false;
     }
 }