pas d'erreur s'il manque la cle privee pour l'ax : enleve la fonctionnalite
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 18 Jun 2006 00:08:32 +0000 (00:08 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 18 Jun 2006 00:08:32 +0000 (00:08 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@321 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/admin/synchro_ax.php
htdocs/profil.php
include/synchro_ax.inc.php
include/webservices/ax/config.inc
templates/admin/synchro_ax.tpl
templates/profil/general.tpl

index 45205aa..dccb972 100644 (file)
@@ -24,9 +24,15 @@ require_once("xorg.inc.php");
 new_admin_page('admin/synchro_ax.tpl');
 $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
 
-require_once('user.func.inc.php');
 require_once('synchro_ax.inc.php');
 
+if (is_ax_key_missing()) {
+    $page->assign('no_private_key', true);
+    $page->run();
+}
+
+require_once('user.func.inc.php');
+
 if (Env::has('user')) {
     $login = get_user_forlife(Env::get('user'));
     if ($login === false) {
index d8455df..42727de 100644 (file)
@@ -31,8 +31,11 @@ if (Post::has('register_from_ax_question')) {
     $globals->xdb->query('UPDATE auth_user_quick SET profile_from_ax = 1 WHERE user_id = {?}', Session::getInt('uid'));
 }
 
-if (Env::get('synchro_ax') == 'confirm') {
-    require_once('synchro_ax.inc.php');
+require_once('synchro_ax.inc.php');
+if (is_ax_key_missing())
+    $page->assign('no_private_key', true);
+
+if (Env::get('synchro_ax') == 'confirm' && !is_ax_key_missing()) {
     ax_synchronize(Session::get('bestalias'), Session::getInt('uid'));
     $page->trig('Ton profil a été synchronisé avec celui du site polytechniciens.com');
 }
index b0b5b2f..ab0c8b6 100644 (file)
@@ -24,6 +24,11 @@ require_once("xorg.inc.php");
 
 require_once('user.func.inc.php');
 
+function is_ax_key_missing() {
+    global $globals;
+    return !$globals->webservice->private_key_ax || !is_file($globals->webservice->private_key_ax);
+}
+
 function get_user_ax($matricule_ax, $raw=false)
 {
     require_once('webservices/ax/client.inc');
index 88b9813..199e7e9 100755 (executable)
@@ -2,7 +2,7 @@
        \r
        global $globals;\r
         //chemin de stockage de la clé privée  A MODIFIER\r
-        $chemin_cle_privee = $globals->spoolroot."/configs/cle_privee_ax.pem";\r
+        $chemin_cle_privee = $globals->webservice->private_key_ax;\r
         //phrase cryptant la clé privée\r
         $phrase = $globals->webservice->pass_ax;\r
 //     "Cryptage de la cle pour polytechnique.org";\r
index b8239f7..4e1c406 100644 (file)
   Synchronisation depuis l'AX
 </h1>
 
+{if $no_private_key}
+<p>
+  Impossible d'utiliser ce service, il manque la clef privée AX dans la configuration de plat/al.
+</p>
+{else}
 <form action='{$smarty.request.PHP_SELF}' method='get'>
 <table class="tinybicol">
 <tr>
@@ -37,8 +42,9 @@
 </tr>
 </table>
 </form>
+{/if}
 
-{if $x}
+{if $x and !no_private_key}
 <form action='{$smarty.request.PHP_SELF}' method='post'>
 {if $x.profile_from_ax}
 <div style="text-align:center;margin:5px;background:green">
index 0429a4d..1144e68 100644 (file)
   </table>
 </div>
 
+{if !$no_private_key}
 <div class="blocunite">
   <table class="bicol" cellspacing="0" cellpadding="0" 
     summary="Profil : Informations générales">
     </tr>
   </table>
 </div>
+{/if}
     
 <div class="blocunite">
   <table class="bicol" cellspacing="0" cellpadding="0"