Merge branch 'platal-0.9.17'
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 19 Oct 2008 03:15:06 +0000 (05:15 +0200)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 19 Oct 2008 03:15:06 +0000 (05:15 +0200)
1  2 
modules/auth.php

diff --combined modules/auth.php
@@@ -132,7 -132,7 +132,7 @@@ class AuthModule extends PLModul
  
      function handler_groupex(&$page, $charset = 'utf8')
      {
 -        require_once dirname(__FILE__).'/auth/auth.inc.php';
 +        $this->load('auth.inc.php');
          $page->assign('referer', true);
  
          $gpex_pass = $_GET["pass"];
          $uid = S::i('uid');
          if (!isset($_SESSION['suid'])) {
              $logger = (isset($_SESSION['log']) && $_SESSION['log']->uid == $uid)
 -                            ? $_SESSION['log'] : new CoreLogger($uid);
 +                            ? $_SESSION['log'] : new PlLogger($uid);
              global $platal;
 -            $logger->log('connexion_auth_ext', $platal->path);
 +            S::logger()->log('connexion_auth_ext', $platal->path);
          }
  
          /* on parcourt les entrees de groupes_auth */
-         $res = XDB::iterRow('SELECT privkey, name, datafields FROM groupesx_auth');
+         $res = XDB::iterRow('SELECT privkey, name, datafields, returnurls FROM groupesx_auth');
  
-         while (list($privkey,$name,$datafields) = $res->next()) {
+         while (list($privkey,$name,$datafields,$returnurls) = $res->next()) {
              if (md5($gpex_challenge.$privkey) == $gpex_pass) {
-                 $returl = $gpex_url . gpex_make_params($gpex_challenge, $privkey, $datafields, $charset);
-                 http_redirect($returl);
+                 if ($returnurls == "" || @preg_match($returnurls, $gpex_url)) {
+                     $returl = $gpex_url . gpex_make_params($gpex_challenge, $privkey, $datafields, $charset);
+                     http_redirect($returl);
+                 }
              }
          }
  
  
      function handler_admin_authgroupesx(&$page, $action = 'list', $id = null)
      {
 -        $page->assign('xorg_title','Polytechnique.org - Administration - Auth groupes X');
 +        $page->setTitle('Administration - Auth groupes X');
          $page->assign('title', 'Gestion de l\'authentification centralisée');
          $table_editor = new PLTableEditor('admin/auth-groupes-x','groupesx_auth','id');
          $table_editor->describe('name','nom',true);
          $table_editor->describe('privkey','clé privée',false);
          $table_editor->describe('datafields','champs renvoyés',true);
+         $table_editor->describe('returnurls','urls de retour',true);
          $table_editor->apply($page, $action, $id);
      }
  }