lemonldap-ng/po-doc/fr/pages/documentation/current/notifications.html
Xavier Guimard bd68e07f42 Add #971 doc
2017-03-04 14:38:41 +00:00

482 lines
27 KiB
HTML

<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
<title>documentation:2.0:notifications</title><!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else --><!-- //endif -->
<meta name="generator" content="DokuWiki"/>
<meta name="robots" content="index,follow"/>
<meta name="keywords" content="documentation,2.0,notifications"/>
<link rel="search" type="application/opensearchdescription+xml" href="lib/exe/opensearch.html" title="LemonLDAP::NG"/>
<link rel="start" href="notifications.html"/>
<link rel="contents" href="notifications.html" title="Sitemap"/>
<link rel="stylesheet" type="text/css" href="lib/exe/css.php.t.bootstrap3.css"/>
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<script type="text/javascript">/*<![CDATA[*/var NS='documentation:2.0';var JSINFO = {"id":"documentation:2.0:notifications","namespace":"documentation:2.0"};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="lib/exe/js.php.t.bootstrap3.js"></script><!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script><!-- //endif --><!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/lib/scripts/jquery-ui.min.js"></script>
//else -->
<script type="text/javascript" src="/lib/scripts/jquery-ui.js"></script><!-- //endif -->
</head>
<body>
<div class="dokuwiki export container"><!-- TOC START -->
<div id="dw__toc">
<h3 class="toggle">Table of Contents</h3>
<div>
<ul class="toc">
<li class="level1"><div class="li"><a href="#installation">Installation</a></div>
<ul class="toc">
<li class="level2"><div class="li"><a href="#activation">Activation</a></div></li>
<li class="level2"><div class="li"><a href="#storage">Stockage</a></div>
<ul class="toc">
<li class="level3"><div class="li"><a href="#file">File</a></div></li>
<li class="level3"><div class="li"><a href="#dbi">DBI</a></div></li>
<li class="level3"><div class="li"><a href="#ldap">LDAP</a></div></li>
</ul>
</li>
<li class="level2"><div class="li"><a href="#wildcard">Carte blanche</a></div></li>
</ul>
</li>
<li class="level1"><div class="li"><a href="#using_notification_system">Utiliser le système de notification</a></div>
<ul class="toc">
<li class="level2"><div class="li"><a href="#notification_format">Format des notifications</a></div>
<ul class="toc">
<li class="level3"><div class="li"><a href="#examples">Examples</a></div></li>
</ul>
</li>
<li class="level2"><div class="li"><a href="#create_new_notifications_with_notifications_explorer">Créer de nouvelles notifications avec l'explorateur des notifications</a></div></li>
<li class="level2"><div class="li"><a href="#notification_server">Notification server</a></div>
<ul class="toc">
<li class="level3"><div class="li"><a href="#json_notifications_through_rest">JSON notifications through REST</a></div></li>
<li class="level3"><div class="li"><a href="#xml_notifications_trough_soap">XML notifications trough SOAP</a></div></li>
<li class="level3"><div class="li"><a href="#deletion_example_in_perl">Exemple d'effacement en Perl</a></div></li>
</ul>
</li>
<li class="level2"><div class="li"><a href="#test_notification">Tester les notifications</a></div></li>
</ul></li>
</ul>
</div>
</div><!-- TOC END -->
<h1 class="sectionedit1" id="notifications_system">Systèmes de notification</h1>
<div class="level1">
<p>
Depuis la version 0.9.4, LemonLDAP::NG peut être utilisé pour notifier des messages aux utilisateurs : si un utilisateur a un message, celui-ci est affiché lorsqu'il accède au portail. Si le message contient des cases à cocher, l'utilisateur doit toutes les cocher, sinon il ne peut obtenir de cookie de session.
</p>
<p>
Depuis la version 1.1.0, un explorateur de notifications est disponible dans le manager, et les notifications peuvent être faites pour tous les utilisateurs, avec possibilité d'affichage conditionnel. Lorsque l'utilisateur accepte la notification, la référence est stockée dans ses données de session persistentes.
</p>
</div><!-- EDIT1 SECTION "Notifications system" [1-586] -->
<h2 class="sectionedit2" id="installation">Installation</h2>
<div class="level2">
</div><!-- EDIT2 SECTION "Installation" [587-612] -->
<h3 class="sectionedit3" id="activation">Activation</h3>
<div class="level3">
<p>
Il suffit d'activer les notifications dans le manager (Paramètres généraux &gt; Paramètres avancés &gt; Notifications &gt; Activation) ou dans lemonldap-ng.ini :
</p>
<pre class="code file ini"><span class="re0"><span class="br0">[</span>portal<span class="br0">]</span></span>
<span class="re1">notification</span> <span class="sy0">=</span><span class="re2"> 1</span></pre>
</div><!-- EDIT3 SECTION "Activation" [613-831] -->
<h3 class="sectionedit4" id="storage">Stockage</h3>
<div class="level3">
<p>
Par défaut, les notifications sont stockées dans la même base de données que la configuration :
</p>
<ul>
<li class="level1"><div class="li"> si “File” est utilisé et que “dirName” vaut /usr/local/lemonldap-ng/conf/, les notifications seront stockées dans /usr/local/lemonldap-ng/notifications/</div>
</li>
<li class="level1"><div class="li"> si “CDBI” ou “RDBI” est utilisé, les notifications sont stockées dans la même base de données que la configuration et la table est nommée “notifications”.</div>
</li>
<li class="level1"><div class="li"> si “LDAP” est utilisé, les notifications sont stockées dans la même arborescence que la configuration et la branche est nommée “notifications”.</div>
</li>
</ul>
<p>
On peut changer les paramètres par défaut en utilisant les paramètres “notificationStorage” et “notificationStorageOptions” avec la même syntaxe que les paramètres de stockage de la configuration. pour ce faire dans le manager, aller dans Paramètres généraux &gt; Paramètres avancés &gt; Notifications.
</p>
</div>
<h4 id="file">File</h4>
<div class="level4">
<p>
Les paramètres pour le backend File sont les mêmes que ceux du <a href="fileconfbackend.html" class="wikilink1" title="documentation:2.0:fileconfbackend">backend de configuration File</a>.
</p>
<div class="noteimportant">Il faut créer soi-même le répertoire et y donner un accès en écriture pour l'utilisateur Apache. Par exemple :
<pre class="code">mkdir /usr/local/lemonldap-ng/notifications/
chown www-data /usr/local/lemonldap-ng/notifications/</pre>
</div><div class="notetip">Le séparateur par défaut des noms de fichiers est <code>_</code>, ce qui peut poser problème si on enregistre des notifications pour des utilsateur ayant un caractère <code>_</code> dans leur nom de connexion. On peut changer ce séparateur en changeant la valeur de l'option <code>fileNameSeparator</code> par exemple <code>@</code>.
</div>
<p>
Pour résumer les options disponibles :
</p>
<ul>
<li class="level1"><div class="li"> <strong>dirName</strong> : répertoire dans lequel sont stockées les notifications.</div>
</li>
<li class="level1"><div class="li"> <strong>fileNameSeparator</strong> : séparateur de nom de fichier.</div>
</li>
</ul>
</div>
<h4 id="dbi">DBI</h4>
<div class="level4">
<p>
Les paramètres pour le backend <abbr title="Database Interface">DBI</abbr> sont les mêmes que ceux du <a href="sqlconfbackend.html" class="wikilink1" title="documentation:2.0:sqlconfbackend">backend de configuration DBI</a>.
</p>
<div class="noteimportant">Il faut créer soi-même la table :
<pre class="code sql"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> notifications <span class="br0">(</span>
<span class="kw1">DATE</span> datetime <span class="kw1">NOT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
uid <span class="kw1">VARCHAR</span><span class="br0">(</span><span class="nu0">255</span><span class="br0">)</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
<span class="kw1">REF</span> <span class="kw1">VARCHAR</span><span class="br0">(</span><span class="nu0">255</span><span class="br0">)</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
cond <span class="kw1">VARCHAR</span><span class="br0">(</span><span class="nu0">255</span><span class="br0">)</span> <span class="kw1">DEFAULT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
xml longblob <span class="kw1">NOT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
done datetime <span class="kw1">DEFAULT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
<span class="kw1">PRIMARY</span> <span class="kw1">KEY</span> <span class="br0">(</span><span class="kw1">DATE</span><span class="sy0">,</span> uid<span class="sy0">,</span><span class="kw1">REF</span><span class="br0">)</span>
<span class="br0">)</span></pre>
</div>
<p>
Pour résumer les options disponibles :
</p>
<ul>
<li class="level1"><div class="li"> <strong>dbiChain</strong> : chaîne de connexion <abbr title="Database Interface">DBI</abbr>.</div>
</li>
<li class="level1"><div class="li"> <strong>dbiUser</strong> : utilisateur <abbr title="Database Interface">DBI</abbr>.</div>
</li>
<li class="level1"><div class="li"> <strong>dbiPassword</strong> : mot-de-passe <abbr title="Database Interface">DBI</abbr>.</div>
</li>
<li class="level1"><div class="li"> <strong>table</strong> : nom de la table des notifications.</div>
</li>
</ul>
</div>
<h4 id="ldap">LDAP</h4>
<div class="level4">
<p>
Les paramètres pour le backend LDAP sont les mêmes que ceux du <a href="ldapconfbackend.html" class="wikilink1" title="documentation:2.0:ldapconfbackend">backend de configuration LDAP</a>.
</p>
<div class="noteimportant">Il faut toutefois créer manuellement la branche
</div>
<p>
Pour résumer les options disponibles :
</p>
<ul>
<li class="level1"><div class="li"> <strong>ldapServer</strong> : <abbr title="Uniform Resource Locator">URL</abbr> du serveur LDAP.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapBindDN</strong> : utilisateur LDAP.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapBindPassword</strong> : mot-de-passe LDAP.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapConfBase</strong> : <abbr title="Distinguished Name">DN</abbr> de la branche des notifications.</div>
</li>
</ul>
</div><!-- EDIT4 SECTION "Storage" [832-3326] -->
<h3 class="sectionedit5" id="wildcard">Carte blanche</h3>
<div class="level3">
<p>
Le module de notifications utilise une carte blanche pour gérer les notifications destinées à tous les utilisateurs. The default value of this wildcard is <code>allusers</code>, but you can change it if <code>allusers</code> is a known identifier in your system.
</p>
<p>
Pour le changer, aller dans Paramètres généraux &gt; Paramètres avancés &gt; Notifications &gt; Carte blanche pour tous les utilisateurs, et mettre par exemple <code>alluserscustom</code>.
</p>
<p>
Ainsi, créer une notification pour <code>alluserscustom</code> affichera la notification à tous les utilisateurs.
</p>
</div><!-- EDIT5 SECTION "Wildcard" [3327-3797] -->
<h2 class="sectionedit6" id="using_notification_system">Utiliser le système de notification</h2>
<div class="level2">
<div class="noteimportant">Since version 2.0, notifications are now stored in JSON format. If you want to keep old format, select “use old format” in the manager. Note that the server for inserting notifications is paired with the chosen format: REST for JSON and SOAP for XML.
</div>
</div><!-- EDIT6 SECTION "Using notification system" [3798-4111] -->
<h3 class="sectionedit7" id="notification_format">Format des notifications</h3>
<div class="level3">
<p>
Notifications are JSON (default) or XML files containing:
</p>
<ul>
<li class="level1"><div class="li"> élément(s) &lt;notification&gt; :</div>
<ul>
<li class="level2"><div class="li"> Attibuts requis :</div>
<ul>
<li class="level3"><div class="li"> date : date de création (format AAAA-MM-JJ)</div>
</li>
<li class="level3"><div class="li"> ref : une référence qui peut être utilisée plus tard pour connaître ce qui a été notifié et quand</div>
</li>
<li class="level3"><div class="li"> uid : le nom de connexion de l'utilisateur (il doit correspondre à l'attribut utilisé dans le paramètre whatToTrace, uid par défaut), ou la carte blanche (par défaut : <code>allusers</code>) si la notification doit être affichée à tous les utilisateurs.</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> Attributs optionnels :</div>
<ul>
<li class="level3"><div class="li"> condition : condition pour afficher la notification, peut utiliser toutes les variables de session.</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> Éléments subordonnés :</div>
<ul>
<li class="level3"><div class="li"> &lt;title&gt; : titre à afficher : sera inséré dans la page <abbr title="HyperText Markup Language">HTML</abbr> encadré dans &lt;h2 class=“notifText”&gt;&lt;/h2&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;subtitle&gt; : sous-titre : sera inséré dans la page <abbr title="HyperText Markup Language">HTML</abbr> encadré dans &lt;h2 class=“notifText”&gt;&lt;/h2&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;text&gt; : paragraphe à afficher : sera inséré dans la page <abbr title="HyperText Markup Language">HTML</abbr> encadré dans &lt;p class=“notifText”&gt;&lt;/p&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;check&gt; : paragraphe à afficher avec une case à cocher : sera inséré dans la page <abbr title="HyperText Markup Language">HTML</abbr> encadré dans &lt;p class=“notifCheck”&gt;&lt;input type=“checkbox” /&gt;&lt;/p&gt;</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="noteimportant">Tous les autres éléments seront supprimés y compris les balises <abbr title="HyperText Markup Language">HTML</abbr> telles &lt;b&gt;.
</div><div class="notetip">Un document XML de notification peut contenir plusieurs messages de notification.
</div>
</div>
<h4 id="examples">Examples</h4>
<div class="level4">
</div>
<h5 id="json">JSON</h5>
<div class="level5">
<pre class="code file json">{
"uid": "foo.bar",
"date": "2009-01-27",
"reference"; "ABC",
"title": "You have new authorizations",
"subtitle": "Application 1",
"text": "You have been granted to access to appli-1",
"check": [
"I aggree",
"Yes, I'm sure"
]</pre>
</div>
<h5 id="xml">XML</h5>
<div class="level5">
<pre class="code file xml"><span class="sc3"><span class="re1"><?xml version="1.0" encoding="UTF-8"?></span></span>
<span class="sc3"><span class="re1">&lt;root<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;notification</span> <span class="re0">uid</span>=<span class="st0">"foo.bar"</span> <span class="re0">date</span>=<span class="st0">"2009-01-27"</span> <span class="re0">reference</span>=<span class="st0">"ABC"</span><span class="re2">&gt;</span></span>
<span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Vous avez de nouvelles autorisations<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;subtitle<span class="re2">&gt;</span></span></span>Application 1<span class="sc3"><span class="re1">&lt;/subtitle<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;text<span class="re2">&gt;</span></span></span>Vous êtes autorisé à accéder à appli-1<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;subtitle<span class="re2">&gt;</span></span></span>Application 2<span class="sc3"><span class="re1">&lt;/subtitle<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;text<span class="re2">&gt;</span></span></span>Vous êtes autorisé à accéder à appli-2<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;subtitle<span class="re2">&gt;</span></span></span>Acceptation<span class="sc3"><span class="re1">&lt;/subtitle<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;check<span class="re2">&gt;</span></span></span>Je reconnais savoir que je peux accéder à appli-1 <span class="sc3"><span class="re1">&lt;/check<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;check<span class="re2">&gt;</span></span></span>Je reconnais savoir que je peux accéder à appli-2 <span class="sc3"><span class="re1">&lt;/check<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/notification<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;notification</span> <span class="re0">uid</span>=<span class="st0">"allusers"</span> <span class="re0">date</span>=<span class="st0">"2009-01-27"</span> <span class="re0">reference</span>=<span class="st0">"disclaimer"</span> <span class="re0">condition</span>=<span class="st0">"$ipAddr =~ /^192/"</span><span class="re2">&gt;</span></span>
<span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Ceci est votre premier accès à ce système<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;text<span class="re2">&gt;</span></span></span>Soyez sage et ne le cassez pas.<span class="sc3"><span class="re1">&lt;/text<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;check<span class="re2">&gt;</span></span></span>Bien sûr, je ne suis pas méchant !<span class="sc3"><span class="re1">&lt;/check<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/notification<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/root<span class="re2">&gt;</span></span></span></pre>
</div><!-- EDIT7 SECTION "Notification format" [4112-6510] -->
<h3 class="sectionedit8" id="create_new_notifications_with_notifications_explorer">Créer de nouvelles notifications avec l'explorateur des notifications</h3>
<div class="level3">
<p>
Dans le manager, cliquer sur l'<code>explorateur des notifications</code> et ensuite sur le bouton <code>Créer</code>.
</p>
<p>
<img src="documentation/manager-notification.png" class="mediacenter" alt="" />
</p>
<p>
Remplir ensuite tous les champs pour créer la notification. Seule la condition n'est pas exigée.
</p>
<p>
Lorsque tout est bon, cliquer sur <code>Sauver</code>.
</p>
</div><!-- EDIT8 SECTION "Create new notifications with notifications explorer" [6511-6829] -->
<h3 class="sectionedit9" id="notification_server">Notification server</h3>
<div class="level3">
<p>
New JSON notifications can be inserted using REST or SOAP server. If enabled, the server <abbr title="Uniform Resource Locator">URL</abbr> is <a href="https://auth.your.domain/notifications" class="urlextern" title="https://auth.your.domain/notifications" rel="nofollow">https://auth.your.domain/notifications</a>.
</p>
<div class="noteimportant">If notification server is enabled, you have to protect this <abbr title="Uniform Resource Locator">URL</abbr> using the webserver because there is no authentication required to use it.
</div>
<p>
Exemple :
</p>
<pre class="code file apache"><span class="co1"># SOAP functions for notification insertion (disabled by default)</span>
&lt;<span class="kw3">LocationMatch</span> ^/(index\.fcgi/)?notifications&gt;
<span class="kw1">Order</span> <span class="kw1">deny</span>,<span class="kw1">allow</span>
<span class="kw1">Deny</span> from <span class="kw2">all</span>
<span class="kw1">Allow</span> from 192.168.2.0/<span class="nu0">24</span>
&lt;/<span class="kw3">Location</span>&gt;</pre>
</div>
<h4 id="json_notifications_through_rest">JSON notifications through REST</h4>
<div class="level4">
<p>
Using JSON, you just have to POST json files.
</p>
</div>
<h4 id="xml_notifications_trough_soap">XML notifications trough SOAP</h4>
<div class="level4">
<p>
If you use old XML format, new notifications can be inserted using SOAP request.
</p>
</div>
<h5 id="insertion_example_in_perl">Exemple d'insertion en Perl</h5>
<div class="level5">
<pre class="code perl"><span class="co1">#!/usr/bin/perl</span>
&nbsp;
<span class="kw2">use</span> SOAP<span class="sy0">::</span><span class="me2">Lite</span><span class="sy0">;</span>
<span class="kw2">use</span> utf8<span class="sy0">;</span>
&nbsp;
<span class="kw1">my</span> <span class="re0">$lite</span> <span class="sy0">=</span> SOAP<span class="sy0">::</span><span class="me2">Lite</span>
<span class="sy0">-&gt;</span><span class="me1">uri</span><span class="br0">(</span><span class="st_h">'urn:Lemonldap::NG::Common::PSGI::SOAPService'</span><span class="br0">)</span>
<span class="sy0">-&gt;</span><span class="me1">proxy</span><span class="br0">(</span><span class="st_h">'http://auth.example.com/notifications'</span><span class="br0">)</span><span class="sy0">;</span>
&nbsp;
&nbsp;
<span class="re0">$r</span> <span class="sy0">=</span> <span class="re0">$lite</span><span class="sy0">-&gt;</span><span class="me1">newNotification</span><span class="br0">(</span>
<span class="st_h">'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
&lt;root&gt;
&lt;notification uid="foo.bar" date="2009-01-27" reference="ABC"&gt;
&lt;text&gt; You have been granted to access to appli-1 &lt;/text&gt;
&lt;text&gt; You have been granted to access to appli-2 &lt;/text&gt;
&lt;check&gt; I know that I can acces to appli-1 &lt;/check&gt;
&lt;check&gt; I know that I can acces to appli-2 &lt;/check&gt;
&lt;/notification&gt;
&lt;/root&gt;
'</span><span class="br0">)</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">(</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span> <span class="br0">)</span> <span class="br0">{</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="kw2">STDERR</span> <span class="st0">"SOAP Error: "</span> <span class="sy0">.</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span><span class="sy0">-&gt;</span><span class="br0">{</span>faultstring<span class="br0">}</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="kw1">else</span> <span class="br0">{</span>
<span class="kw1">my</span> <span class="re0">$res</span> <span class="sy0">=</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">result</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">"$res notification(s) have been inserted<span class="es0">\n</span>"</span><span class="sy0">;</span>
<span class="br0">}</span></pre>
<p>
On peut également effacer certaines notifications avec SOAP, si SOAP est activé :
</p>
</div>
<h4 id="deletion_example_in_perl">Exemple d'effacement en Perl</h4>
<div class="level4">
<pre class="code perl"><span class="co1">#!/usr/bin/perl</span>
&nbsp;
<span class="kw2">use</span> SOAP<span class="sy0">::</span><span class="me2">Lite</span><span class="sy0">;</span>
<span class="kw2">use</span> utf8<span class="sy0">;</span>
&nbsp;
<span class="kw1">my</span> <span class="re0">$lite</span> <span class="sy0">=</span> SOAP<span class="sy0">::</span><span class="me2">Lite</span>
<span class="sy0">-&gt;</span><span class="me1">uri</span><span class="br0">(</span><span class="st_h">'urn:Lemonldap::NG::Common::CGI::SOAPService'</span><span class="br0">)</span>
<span class="sy0">-&gt;</span><span class="me1">proxy</span><span class="br0">(</span><span class="st_h">'http://auth.example.com/index.pl/notification'</span><span class="br0">)</span><span class="sy0">;</span>
&nbsp;
&nbsp;
<span class="re0">$r</span> <span class="sy0">=</span> <span class="re0">$lite</span><span class="sy0">-&gt;</span><span class="me1">deleteNotification</span><span class="br0">(</span><span class="st_h">'foo.bar'</span><span class="sy0">,</span> <span class="st_h">'ABC'</span><span class="br0">)</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">(</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span> <span class="br0">)</span> <span class="br0">{</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="kw2">STDERR</span> <span class="st0">"SOAP Error: "</span> <span class="sy0">.</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span><span class="sy0">-&gt;</span><span class="br0">{</span>faultstring<span class="br0">}</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="kw1">else</span> <span class="br0">{</span>
<span class="kw1">my</span> <span class="re0">$res</span> <span class="sy0">=</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">result</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">"$res notification(s) have been deleted<span class="es0">\n</span>"</span><span class="sy0">;</span>
<span class="br0">}</span></pre>
</div><!-- EDIT9 SECTION "Notification server" [6830-8963] -->
<h3 class="sectionedit10" id="test_notification">Tester les notifications</h3>
<div class="level3">
<p>
Il suffit d'insérer une notification et de se connecter au portail en utilisant le même UID. Le message sera affiché.
</p>
<p>
<img src="documentation/portal-notification.png" class="mediacenter" alt="" />
</p>
<p>
Essayer alors de créer une notification globale (à l'utilisateur “allusers”), et se connecter avec n'importe quel compte, le message sera affiché.
</p>
</div><!-- EDIT10 SECTION "Test notification" [8964-] -->
</div>
</body>
</html>