X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fauth.php;h=da708a541a59621a06d40fdde2f06740fc6b9198;hb=08cce2ff528b38bde27cdec6d6bc28d6af4a42d4;hp=34c2b30f46db7196186fff081c983baa99b40de7;hpb=d5749a28dfcae4ab1bf4d2bda39ce248e2bbfb71;p=platal.git diff --git a/modules/auth.php b/modules/auth.php index 34c2b30..da708a5 100644 --- a/modules/auth.php +++ b/modules/auth.php @@ -24,22 +24,27 @@ class AuthModule extends PLModule function handlers() { return array( - 'groupex/done-chall.php' => $this->make_hook('chall', AUTH_PUBLIC), - 'groupex/export-econfiance.php' => $this->make_hook('econf', AUTH_PUBLIC), + 'groupex/done-chall.php' + => $this->make_hook('chall', AUTH_PUBLIC), + 'groupex/export-econfiance.php' + => $this->make_hook('econf', AUTH_PUBLIC), - 'auth-redirect.php' => $this->make_hook('redirect', AUTH_COOKIE), - 'auth-groupex.php' => $this->make_hook('groupex', AUTH_COOKIE), + 'webservices/manageurs.php' + => $this->make_hook('manageurs', AUTH_PUBLIC), + + 'auth-redirect.php' => $this->make_hook('redirect', AUTH_COOKIE), + 'auth-groupex.php' => $this->make_hook('groupex', AUTH_COOKIE), ); } - function chall(&$page) + function handler_chall(&$page) { $_SESSION["chall"] = uniqid(rand(), 1); echo $_SESSION["chall"] . "\n" . session_id(); exit; } - function econf(&$page) + function handler_econf(&$page) { global $globals; @@ -50,7 +55,7 @@ class AuthModule extends PLModule if (Session::get('chall') && $_GET['PASS'] == md5(Session::get('chall').$cle)) { - $res = $globals->xdb->query("SELECT password FROM auth_user_md5 WHERE user_id=10154"); + $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id=10154"); $pass = $res->fetchOneCell(); $client =& lists_xmlrpc(10154, $pass, "x-econfiance.polytechnique.org"); @@ -68,7 +73,7 @@ class AuthModule extends PLModule $where = join(' OR ',$membres); - $all = $globals->xdb->iterRow( + $all = XDB::iterRow( "SELECT u.prenom,u.nom,a.alias FROM auth_user_md5 AS u INNER JOIN aliases AS a ON ( u.user_id = a.id AND a.type!='homonyme' ) @@ -92,6 +97,27 @@ class AuthModule extends PLModule exit; } + function handler_manageurs(&$page) + { + global $globals; + + require_once 'webservices/manageurs.server.inc.php'; + + $ips = array_flip(explode(' ',$globals->manageurs->authorized_ips)); + if ($ips && isset($ips[$_SERVER['REMOTE_ADDR']])) { + $server = xmlrpc_server_create(); + + xmlrpc_server_register_method($server, 'get_annuaire_infos', 'get_annuaire_infos'); + xmlrpc_server_register_method($server, 'get_nouveau_infos', 'get_nouveau_infos'); + + $request = $GLOBALS['HTTP_RAW_POST_DATA']; + $response = xmlrpc_server_call_method($server, $request, null); + header('Content-Type: text/xml'); + print $response; + xmlrpc_server_destroy($server); + } + } + function handler_redirect(&$page) { redirect(Env::get('dest', '/')); @@ -101,7 +127,7 @@ class AuthModule extends PLModule { global $globals; - require_once dirname(__FILE__).'/auth/methods.inc.php'; + require_once dirname(__FILE__).'/auth/auth.inc.php'; $gpex_pass = $_GET["pass"]; $gpex_url = urldecode($_GET["url"]); @@ -125,7 +151,7 @@ class AuthModule extends PLModule } /* on parcourt les entrees de groupes_auth */ - $res = $globals->xdb->iterRow('select privkey,name,datafields from groupesx_auth'); + $res = XDB::iterRow('select privkey,name,datafields from groupesx_auth'); while (list($privkey,$name,$datafields) = $res->next()) { if (md5($gpex_challenge.$privkey) == $gpex_pass) {