LemonLDAP::NG Web SSO
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lemonldap-ng/doc/pages/documentation/current/notifications.html

471 lines
26 KiB

9 years ago
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>documentation:2.0:notifications</title>
<meta name="generator" content="DokuWiki"/>
9 years ago
<meta name="robots" content="index,follow"/>
9 years ago
<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"/>
<!-- //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 -->
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<!-- //endif -->
9 years ago
<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 -->
9 years ago
</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">Storage</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">Wildcard</a></div></li>
</ul>
</li>
<li class="level1"><div class="li"><a href="#using_notification_system">Using notification system</a></div>
<ul class="toc">
9 years ago
<li class="level2"><div class="li"><a href="#notification_format">Notification format</a></div>
<ul class="toc">
<li class="level3"><div class="li"><a href="#examples">Examples</a></div></li>
</ul>
</li>
9 years ago
<li class="level2"><div class="li"><a href="#create_new_notifications_with_notifications_explorer">Create new notifications with notifications explorer</a></div></li>
9 years ago
<li class="level2"><div class="li"><a href="#notification_server">Notification server</a></div>
9 years ago
<ul class="toc">
9 years ago
<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>
9 years ago
<li class="level3"><div class="li"><a href="#deletion_example_in_perl">Deletion example in Perl</a></div></li>
</ul>
</li>
<li class="level2"><div class="li"><a href="#test_notification">Test notification</a></div></li>
</ul></li>
</ul>
</div>
</div>
<!-- TOC END -->
<h1 class="sectionedit1" id="notifications_system">Notifications system</h1>
<div class="level1">
<p>
Since version 0.9.4, LemonLDAP::NG can be used to notify some messages to users: if a user has a message, the message will be displayed when he will access to the portal. If the message contains check boxes, the user has to check all of them else he can not access to the portal and get his session cookie.
</p>
<p>
Since 1.1.0, a notification explorer is available in Manager, and notifications can be done for all users, with the possibility to display conditions. When the user accept the notification, the reference is stored in his persistent session.
</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>
You just have to activate Notifications in the Manager (General Parameters &gt; Advanced Parameters &gt; Notifications &gt; Activation) or in lemonldap-ng.ini:
</p>
<pre class="code file ini"><span class="re0"><span class="br0">&#91;</span>portal<span class="br0">&#93;</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">Storage</h3>
<div class="level3">
<p>
By default, notifications will be stored in the same database as configuration:
</p>
<ul>
<li class="level1"><div class="li"> if you use “File” system and your “dirName” is set to /usr/local/lemonldap-ng/conf/, the notifications will be stored in /usr/local/lemonldap-ng/notifications/</div>
</li>
<li class="level1"><div class="li"> if you use “CDBI” or “RDBI” system, the notifications will be stored in the same database as configuration and in a table called “notifications”.</div>
</li>
<li class="level1"><div class="li"> if you use “LDAP” system, the notifications will be stored in the same directory as configuration and in a branch called “notifications”.</div>
</li>
</ul>
<p>
You can change default parameters using the “notificationStorage” and “notificationStorageOptions” parameters with the same syntax as configuration storage parameters. To do this in Manager, go in General Parameters &gt; Advanced Parameters &gt; Notifications.
</p>
</div>
<h4 id="file">File</h4>
<div class="level4">
<p>
Parameters for File backend are the same as <a href="fileconfbackend.html" class="wikilink1" title="documentation:2.0:fileconfbackend">File configuration backend</a>.
</p>
<div class="noteimportant">You need to create yourself the directory and set write access to Apache user. For example:
<pre class="code">mkdir /usr/local/lemonldap-ng/notifications/
chown www-data /usr/local/lemonldap-ng/notifications/</pre>
</div><div class="notetip">The file name default separator is <code>_</code>, this can be a problem if you register notifications for users having <code>_</code> in their login. You can change the separator with the <code>fileNameSeparator</code> option, and set another value, for example <code>@</code>.
</div>
<p>
To summary available options:
</p>
<ul>
<li class="level1"><div class="li"> <strong>dirName</strong>: directory where notifications are stored.</div>
</li>
<li class="level1"><div class="li"> <strong>fileNameSeparator</strong>: file name separator.</div>
</li>
</ul>
</div>
<h4 id="dbi">DBI</h4>
<div class="level4">
<p>
Parameters for <abbr title="Database Interface">DBI</abbr> backend are the same as <a href="sqlconfbackend.html" class="wikilink1" title="documentation:2.0:sqlconfbackend">DBI configuration backend</a>.
</p>
<div class="noteimportant">You have to create the table by yourself:
<pre class="code sql"><span class="kw1">CREATE</span> <span class="kw1">TABLE</span> notifications <span class="br0">&#40;</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">&#40;</span><span class="nu0">255</span><span class="br0">&#41;</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">&#40;</span><span class="nu0">255</span><span class="br0">&#41;</span> <span class="kw1">NOT</span> <span class="kw1">NULL</span><span class="sy0">,</span>
cond <span class="kw1">VARCHAR</span><span class="br0">&#40;</span><span class="nu0">255</span><span class="br0">&#41;</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">&#40;</span><span class="kw1">DATE</span><span class="sy0">,</span> uid<span class="sy0">,</span><span class="kw1">REF</span><span class="br0">&#41;</span>
<span class="br0">&#41;</span></pre>
</div>
<p>
To summary available options:
</p>
<ul>
<li class="level1"><div class="li"> <strong>dbiChain</strong>: <abbr title="Database Interface">DBI</abbr> connection.</div>
</li>
<li class="level1"><div class="li"> <strong>dbiUser</strong>: <abbr title="Database Interface">DBI</abbr> user.</div>
</li>
<li class="level1"><div class="li"> <strong>dbiPassword</strong>: <abbr title="Database Interface">DBI</abbr> password.</div>
</li>
<li class="level1"><div class="li"> <strong>table</strong>: Notifications table name.</div>
</li>
</ul>
</div>
<h4 id="ldap">LDAP</h4>
<div class="level4">
<p>
Parameters for LDAP backend are the same as <a href="ldapconfbackend.html" class="wikilink1" title="documentation:2.0:ldapconfbackend">LDAP configuration backend</a>.
</p>
<div class="noteimportant">You have to create the branch by yourself
</div>
<p>
To summary available options:
</p>
<ul>
<li class="level1"><div class="li"> <strong>ldapServer</strong>: LDAP <abbr title="Uniform Resource Locator">URL</abbr>.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapBindDN</strong>: LDAP user.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapBindPassword</strong>: LDAP password.</div>
</li>
<li class="level1"><div class="li"> <strong>ldapConfBase</strong>: Notifications branch <abbr title="Distinguished Name">DN</abbr>.</div>
</li>
</ul>
</div>
<!-- EDIT4 SECTION "Storage" [832-3326] -->
<h3 class="sectionedit5" id="wildcard">Wildcard</h3>
<div class="level3">
<p>
The notifications module uses a wildcard to manage notifications for all users. 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.
9 years ago
</p>
<p>
To change it, go in General Parameters &gt; Advanced Parameters &gt; Notifications &gt; Wildcard for all users, and set for example <code>alluserscustom</code>.
</p>
<p>
Then creating a notification for <code>alluserscustom</code> will display the notification for all users.
</p>
</div>
<!-- EDIT5 SECTION "Wildcard" [3327-3797] -->
9 years ago
<h2 class="sectionedit6" id="using_notification_system">Using notification system</h2>
9 years ago
<div class="level2">
9 years ago
<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>
9 years ago
</div>
9 years ago
<!-- EDIT6 SECTION "Using notification system" [3798-4111] -->
<h3 class="sectionedit7" id="notification_format">Notification format</h3>
9 years ago
<div class="level3">
<p>
9 years ago
Notifications are JSON (default) or XML files containing:
9 years ago
</p>
<ul>
<li class="level1"><div class="li"> &lt;notification&gt; element(s) :</div>
<ul>
<li class="level2"><div class="li"> Required attributes:</div>
<ul>
<li class="level3"><div class="li"> date: creation date (format YYYY-MM-DD)</div>
</li>
<li class="level3"><div class="li"> ref: a reference that can be used later to know what has been notified and when</div>
</li>
<li class="level3"><div class="li"> uid: the user login (it must correspond to the attribute set in whatToTrace parameter, uid by default), or the wildcard string (by default: <code>allusers</code>) if the notification should be displayed for every user.</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> Optional attributes:</div>
<ul>
<li class="level3"><div class="li"> condition: condition to display the notification, can use all session variables.</div>
</li>
</ul>
</li>
<li class="level2"><div class="li"> Sub elements:</div>
<ul>
<li class="level3"><div class="li"> &lt;title&gt;: title to display: will be inserted in <abbr title="HyperText Markup Language">HTML</abbr> page enclosed in &lt;h2 class=“notifText”&gt;&lt;/h2&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;subtitle&gt;: subtitle to display: will be inserted in <abbr title="HyperText Markup Language">HTML</abbr> page enclosed in &lt;h2 class=“notifText”&gt;&lt;/h2&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;text&gt;: paragraph to display: will be inserted in <abbr title="HyperText Markup Language">HTML</abbr> page enclosed in &lt;p class=“notifText”&gt;&lt;/p&gt;</div>
</li>
<li class="level3"><div class="li"> &lt;check&gt;: paragraph to display with a checkbox: will be inserted in <abbr title="HyperText Markup Language">HTML</abbr> page enclosed in &lt;p class=“notifCheck”&gt;&lt;input type=“checkbox” /&gt;&lt;/p&gt;</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="noteimportant">All other elements will be removed including <abbr title="HyperText Markup Language">HTML</abbr> elements like &lt;b&gt;.
</div><div class="notetip">One notification XML document can contain several notifications messages.
</div>
9 years ago
</div>
<h4 id="examples">Examples</h4>
<div class="level4">
</div>
<h5 id="json">JSON</h5>
<div class="level5">
<pre class="code file json">{
&quot;uid&quot;: &quot;foo.bar&quot;,
&quot;date&quot;: &quot;2009-01-27&quot;,
&quot;reference&quot;; &quot;ABC&quot;,
&quot;title&quot;: &quot;You have new authorizations&quot;,
&quot;subtitle&quot;: &quot;Application 1&quot;,
&quot;text&quot;: &quot;You have been granted to access to appli-1&quot;,
&quot;check&quot;: [
&quot;I aggree&quot;,
&quot;Yes, I'm sure&quot;
]</pre>
</div>
<h5 id="xml">XML</h5>
<div class="level5">
9 years ago
<pre class="code file xml"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span> <span class="re0">standalone</span>=<span class="st0">&quot;no&quot;</span><span class="re2">?&gt;</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">&quot;foo.bar&quot;</span> <span class="re0">date</span>=<span class="st0">&quot;2009-01-27&quot;</span> <span class="re0">reference</span>=<span class="st0">&quot;ABC&quot;</span><span class="re2">&gt;</span></span>
<span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>You have new authorizations<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>You have been granted to access to 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>You have been granted to access to 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>I know that I can access to 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>I know that I can access to 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">&quot;allusers&quot;</span> <span class="re0">date</span>=<span class="st0">&quot;2009-01-27&quot;</span> <span class="re0">reference</span>=<span class="st0">&quot;disclaimer&quot;</span> <span class="re0">condition</span>=<span class="st0">&quot;$ipAddr =~ /^192/&quot;</span><span class="re2">&gt;</span></span>
<span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>This is your first access on this system<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>Be a nice user and do not break it please.<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>Of course I am not evil!<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>
9 years ago
<!-- EDIT7 SECTION "Notification format" [4112-6510] -->
<h3 class="sectionedit8" id="create_new_notifications_with_notifications_explorer">Create new notifications with notifications explorer</h3>
9 years ago
<div class="level3">
<p>
In Manager, click on <code>Notifications</code> and then on the <code>Create</code> button.
</p>
<p>
<img src="documentation/manager-notification.png" class="mediacenter" alt="" />
</p>
<p>
Then fill all inputs to create the notification. Only the condition is not mandatory.
</p>
<p>
When all is ok, click on <code>Save</code>.
</p>
</div>
9 years ago
<!-- EDIT8 SECTION "Create new notifications with notifications explorer" [6511-6829] -->
<h3 class="sectionedit9" id="notification_server">Notification server</h3>
9 years ago
<div class="level3">
<p>
9 years ago
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>
Example:
9 years ago
</p>
<pre class="code file apache"><span class="co1"># SOAP functions for notification insertion (disabled by default)</span>
9 years ago
&lt;<span class="kw3">LocationMatch</span> ^/(index\.fcgi/)?notifications&gt;
9 years ago
<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>
9 years ago
<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>
9 years ago
<div class="level4">
9 years ago
<p>
If you use old XML format, new notifications can be inserted using SOAP request.
9 years ago
</p>
</div>
<h5 id="insertion_example_in_perl">Insertion example in Perl</h5>
<div class="level5">
9 years ago
<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>
9 years ago
<span class="sy0">-&gt;</span><span class="me1">uri</span><span class="br0">&#40;</span><span class="st_h">'urn:Lemonldap::NG::Common::PSGI::SOAPService'</span><span class="br0">&#41;</span>
<span class="sy0">-&gt;</span><span class="me1">proxy</span><span class="br0">&#40;</span><span class="st_h">'http://auth.example.com/notifications'</span><span class="br0">&#41;</span><span class="sy0">;</span>
9 years ago
&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">&#40;</span>
<span class="st_h">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;
&lt;root&gt;
&lt;notification uid=&quot;foo.bar&quot; date=&quot;2009-01-27&quot; reference=&quot;ABC&quot;&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">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">&#40;</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="kw2">STDERR</span> <span class="st0">&quot;SOAP Error: &quot;</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">&#123;</span>faultstring<span class="br0">&#125;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="kw1">else</span> <span class="br0">&#123;</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">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;$res notification(s) have been inserted<span class="es0">\n</span>&quot;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre>
<p>
You can also delete some notifications with SOAP, once SOAP is activated:
</p>
</div>
<h4 id="deletion_example_in_perl">Deletion example in 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">&#40;</span><span class="st_h">'urn:Lemonldap::NG::Common::CGI::SOAPService'</span><span class="br0">&#41;</span>
<span class="sy0">-&gt;</span><span class="me1">proxy</span><span class="br0">&#40;</span><span class="st_h">'http://auth.example.com/index.pl/notification'</span><span class="br0">&#41;</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">&#40;</span><span class="st_h">'foo.bar'</span><span class="sy0">,</span> <span class="st_h">'ABC'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">&#40;</span> <span class="re0">$r</span><span class="sy0">-&gt;</span><span class="me1">fault</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="kw2">STDERR</span> <span class="st0">&quot;SOAP Error: &quot;</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">&#123;</span>faultstring<span class="br0">&#125;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="kw1">else</span> <span class="br0">&#123;</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">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;$res notification(s) have been deleted<span class="es0">\n</span>&quot;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre>
</div>
<!-- EDIT9 SECTION "Notification server" [6830-8963] -->
9 years ago
<h3 class="sectionedit10" id="test_notification">Test notification</h3>
9 years ago
<div class="level3">
<p>
You&#039;ve simply to insert a notification and connect to the portal using the same UID. You will be prompted.
</p>
<p>
<img src="documentation/portal-notification.png" class="mediacenter" alt="" />
</p>
<p>
Try also to create a global notification (to the uid “allusers”), and connect with any user, the message will be prompted.
</p>
</div>
<!-- EDIT10 SECTION "Test notification" [8964-] --></div>
9 years ago
</body>
</html>