Subversion Repositories Applications.papyrus

Rev

Rev 207 | Rev 219 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 207 Rev 208
Line 19... Line 19...
19
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | You should have received a copy of the GNU Lesser General Public                                     |
20
// | License along with this library; if not, write to the Free Software                                  |
20
// | License along with this library; if not, write to the Free Software                                  |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// |                                                                                                      |
22
// |                                                                                                      |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: pap_initialise_auth.inc.php,v 1.5 2004-12-06 12:12:28 jpm Exp $
24
// CVS : $Id: pap_initialise_auth.inc.php,v 1.6 2004-12-06 12:42:02 alex Exp $
25
/**
25
/**
26
* Initialisation de l'authentification.
26
* Initialisation de l'authentification.
27
*
27
*
28
* Suite à la recherche des informations depuis la base de données nous initialisons
28
* Suite à la recherche des informations depuis la base de données nous initialisons
29
* l'authentification des utilisateurs si le site l'utilise.
29
* l'authentification des utilisateurs si le site l'utilise.
Line 35... Line 35...
35
//Auteur original :
35
//Auteur original :
36
*@author            Alexandre GRANIER <alex@tela-botanica.org>
36
*@author            Alexandre GRANIER <alex@tela-botanica.org>
37
//Autres auteurs :
37
//Autres auteurs :
38
*@author            Jean-Pascal MILCENT <jpm@tela-botanica.org>
38
*@author            Jean-Pascal MILCENT <jpm@tela-botanica.org>
39
*@copyright         Tela-Botanica 2000-2004
39
*@copyright         Tela-Botanica 2000-2004
40
*@version           $Revision: 1.5 $ $Date: 2004-12-06 12:12:28 $
40
*@version           $Revision: 1.6 $ $Date: 2004-12-06 12:42:02 $
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
*/
42
*/
Line 43... Line 43...
43
 
43
 
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
Line 63... Line 63...
63
 
63
 
64
// +------------------------------------------------------------------------------------------------------+
64
// +------------------------------------------------------------------------------------------------------+
Line 65... Line 65...
65
// Récupération des informations d'identification pour le site courant
65
// Récupération des informations d'identification pour le site courant
66
 
66
 
67
// Récupération des informations sur le site
67
// Récupération des informations sur le site
68
$requete_auth = 'SELECT gen_site_auth.* '.
68
$requete_auth = 'SELECT gen_site_auth.*, gs_id_site '.
69
                'FROM gen_site_auth, gen_site '.
69
                'FROM gen_site_auth, gen_site '.
Line 70... Line 70...
70
                'WHERE gs_ce_auth <> 0 '
70
                'WHERE gs_ce_auth <> 0 '
Line 119... Line 119...
119
        die('ERREUR Papyrus : impossible de trouver les information authentification. <br />'.
119
        die('ERREUR Papyrus : impossible de trouver les information authentification. <br />'.
120
            'Identifiant auth : '.$ligne_auth->gs_ce_auth.'<br />'.
120
            'Identifiant auth : '.$ligne_auth->gs_ce_auth.'<br />'.
121
            'Ligne n° : '. __LINE__ .'<br />'.
121
            'Ligne n° : '. __LINE__ .'<br />'.
122
            'Fichier : '. __FILE__ );
122
            'Fichier : '. __FILE__ );
123
    }
123
    }
-
 
124
    // On teste le type d'authentification
-
 
125
    $requete = "SELECT * FROM gen_site_relation WHERE gsr_id_site_01=$ligne_auth->gs_id_site and gsr_id_site_01=gsr_id_site_02 and gsr_valeur=" ;
-
 
126
    $resultat = $db->query ($requete) ;
-
 
127
    
124
}
128
}
125
$resultat_auth->free();
129
$resultat_auth->free();
126
 
-
 
127
// Nour regardons à quel type d'identification nous avons à faire:
-
 
128
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
-
 
129
    // Authentification via une base de données
-
 
130
    $param_bdd = array ('dsn' => PAP_DSN,
-
 
131
                        'table' => $_GEN_commun['info_auth_bdd']->gsab_nom_table,
-
 
132
                        'usernamecol' => $_GEN_commun['info_auth_bdd']->gsab_nom_champ_login,
-
 
133
                        'passwordcol' => $_GEN_commun['info_auth_bdd']->gsab_nom_champ_mdp,
-
 
134
                        'cryptType' => $_GEN_commun['info_auth_bdd']->gsab_cryptage_mdp,
-
 
135
                        'db_fields' => '*');
-
 
136
    $_GEN_commun['pear_auth'] = new Auth('DB', $param_bdd, 'GEN_afficherInfoIdentification', 1);
-
 
137
} else if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 2) {
-
 
138
    // Authentification via LDAP
-
 
139
    $param_ldap = array (   'host' => $_GEN_commun['info_auth_ldap']->gsal_serveur,
-
 
140
                            'port' => $_GEN_commun['info_auth_ldap']->gsal_port,
-
 
141
                            'basedn' => $_GEN_commun['info_auth_ldap']->gsal_base_dn,
-
 
142
                            'userattr' => $_GEN_commun['info_auth_ldap']->gsal_uid);
-
 
143
    $_GEN_commun['pear_auth'] = new Auth('LDAP', $param_ldap, 'GEN_afficherInfoIdentification', 1);
-
 
144
} else {
-
 
145
    die('ERREUR Génésia : type identification introuvable. <br />'.
-
 
146
        'Type identification : '.$_GEN_commun['info_auth']->gsa_ce_type_auth.'<br />'.
-
 
147
        'Ligne n° : '. __LINE__ . '<br />'.
-
 
148
        'Fichier : '. __FILE__ . '<br />');
-
 
149
}
-
 
Line -... Line 130...
-
 
130
 
-
 
131
for ($GLOBALS['_PAPYRUS_']['auth'] as $cle => $auth_courrante) {
-
 
132
    // Nour regardons à quel type d'identification nous avons à faire:
-
 
133
    if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
-
 
134
        // Authentification via une base de données
-
 
135
        $param_bdd = array ('dsn' => $auth_courrante['gsab_dsn'],
-
 
136
                            'table' => $auth_courrante['gsab_nom_table'],
-
 
137
                            'usernamecol' => $auth_courrante['gsab_nom_champ_login'],
-
 
138
                            'passwordcol' => $auth_courrante['gsab_nom_champ_mdp'],
-
 
139
                            'cryptType' => $auth_courrante['gsab_cryptage_mdp'],
-
 
140
                            'db_fields' => '*');
-
 
141
        // L'authentification courrante
-
 
142
        if ($ligne_auth->gsa_id_auth == $_GEN_commun['info_site']->gs_ce_auth) {
-
 
143
            $_GEN_commun['pear_auth'] = new Auth('DB', $param_bdd, 'GEN_afficherInfoIdentification', 1);
-
 
144
        }
-
 
145
    } else if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 2) {
-
 
146
        // Authentification via LDAP
-
 
147
        $param_ldap = array (   'host' => $_GEN_commun['info_auth_ldap']->gsal_serveur,
-
 
148
                                'port' => $_GEN_commun['info_auth_ldap']->gsal_port,
-
 
149
                                'basedn' => $_GEN_commun['info_auth_ldap']->gsal_base_dn,
-
 
150
                                'userattr' => $_GEN_commun['info_auth_ldap']->gsal_uid);
-
 
151
        $_GEN_commun['pear_auth'] = new Auth('LDAP', $param_ldap, 'GEN_afficherInfoIdentification', 1);
-
 
152
    } else {
-
 
153
        die('ERREUR Génésia : type identification introuvable. <br />'.
-
 
154
            'Type identification : '.$_GEN_commun['info_auth']->gsa_ce_type_auth.'<br />'.
-
 
155
            'Ligne n° : '. __LINE__ . '<br />'.
-
 
156
            'Fichier : '. __FILE__ . '<br />');
-
 
157
    }
150
 
158
    
151
$_GEN_commun['pear_auth']->setSessionname( 'gen_'.$_GEN_commun['info_auth']->gsa_abreviation);
159
    $_GEN_commun['pear_auth']->setSessionname( 'gen_'.$_GEN_commun['info_auth']->gsa_abreviation);
152
 
160
    
153
$_GEN_commun['pear_auth']->setExpire(3600 * 24 * 30 * 6);// 6 mois
161
    $_GEN_commun['pear_auth']->setExpire(3600 * 24 * 30 * 6);// 6 mois
154
 
162
    
-
 
163
    $_GEN_commun['pear_auth']->start();
Line 155... Line 164...
155
$_GEN_commun['pear_auth']->start();
164
}
156
 
165
 
-
 
166
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
167
* $Log: not supported by cvs2svn $
-
 
168
* Revision 1.5  2004/12/06 12:12:28  jpm
157
/* +--Fin du code ---------------------------------------------------------------------------------------+
169
* Début de gestion des auth multiples.
158
* $Log: not supported by cvs2svn $
170
*
159
* Revision 1.4  2004/10/25 16:28:47  jpm
171
* Revision 1.4  2004/10/25 16:28:47  jpm
160
* Ajout de nouvelles balises Papyrus, ajout vérification mise à jour de Papyrus, meilleure gestion des sessions...
172
* Ajout de nouvelles balises Papyrus, ajout vérification mise à jour de Papyrus, meilleure gestion des sessions...
161
*
173
*