262 lines
8.0 KiB
HTML
262 lines
8.0 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
|
|
<head>
|
|
<meta name="generator" content=
|
|
"HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />
|
|
|
|
<title>Lemonldap::NG documentation:
|
|
4.4-Configure-and-use-notification-system.html</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
|
<style type="text/css">
|
|
/*<![CDATA[*/
|
|
body{
|
|
background: #ddd;
|
|
font-family: sans-serif;
|
|
font-size: 11pt;
|
|
padding: 0 50px;
|
|
}
|
|
div.main-content{
|
|
padding: 10px;
|
|
background: #fff;
|
|
border: 2px #ccc solid;
|
|
}
|
|
a{
|
|
text-decoration: none;
|
|
}
|
|
p.footer{
|
|
text-align: center;
|
|
margin: 5px 0 0 0;
|
|
}
|
|
.heading-1{
|
|
text-align: center;
|
|
color: orange;
|
|
font-variant: small-caps;
|
|
font-size: 20pt;
|
|
}
|
|
.heading-1-1{
|
|
color: orange;
|
|
font-size: 14pt;
|
|
border-bottom: 2px #ccc solid;
|
|
}
|
|
pre{
|
|
background: #eee;
|
|
border: 2px #ccc solid;
|
|
padding: 5px;
|
|
border-left: 10px #ccc solid;
|
|
}
|
|
ul.star li{
|
|
list-style-type: square;
|
|
}
|
|
/*]]>*/
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="main-content">
|
|
<h2 class="heading-1"><span id="HNotificationsystem">Notification
|
|
system</span></h2>
|
|
|
|
<p class="paragraph"></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
|
|
checkboxes, the user has to check all of them else he can not access to
|
|
the portal and get his session cookie.
|
|
|
|
<p class="paragraph"></p>
|
|
|
|
<ul>
|
|
<li>
|
|
<a href="#HInstallation">Installation</a>
|
|
|
|
<ul>
|
|
<li><a href="#HActivation">Activation</a></li>
|
|
|
|
<li><a href="#HStorage">Storage</a></li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="#HUsingnotificationsystem">Using notification system</a>
|
|
|
|
<ul>
|
|
<li>
|
|
<a href="#HInsertnewnotifications">Insert new notifications</a>
|
|
|
|
<ul>
|
|
<li><a href="#HNotificationformat">Notification format</a></li>
|
|
|
|
<li><a href="#HInsertionexampleinPerl">Insertion example in
|
|
Perl</a></li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="#HTestnotification">Test notification</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h3 class="heading-1-1"><span id="HInstallation">Installation</span></h3>
|
|
|
|
<h4 class="heading-1-1-1"><span id="HActivation">Activation</span></h4>
|
|
|
|
<p class="paragraph"></p>You just have to set "notification => 1" in
|
|
the portal.
|
|
|
|
<h4 class="heading-1-1-1"><span id="HStorage">Storage</span></h4>
|
|
|
|
<p class="paragraph"></p>By default, notifications will be stored in the
|
|
same database as configuration :
|
|
|
|
<ul class="star">
|
|
<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/</li>
|
|
|
|
<li>if you use "DBI" system, the notifications will be stored in the
|
|
same database as configuration and in a table called "notifications".
|
|
You have to create the table by yourself </li>
|
|
</ul>
|
|
|
|
<div class="code">
|
|
<pre>
|
|
CREATE TABLE 'notifications' (
|
|
'date' datetime NOT NULL,
|
|
'uid' varchar(255) NOT NULL,
|
|
'ref' varchar(255) NOT NULL,
|
|
'xml' longblob NOT NULL,
|
|
'done' datetime <span class="java-keyword">default</span> NULL,
|
|
PRIMARY KEY ('date','uid','ref')
|
|
)
|
|
</pre>
|
|
</div>
|
|
|
|
<p class="paragraph"></p>You can change default parameters using the
|
|
"notificationStorage" parameter with the same syntax as configStorage.
|
|
Example :
|
|
|
|
<div class="code">
|
|
<pre>
|
|
notificationStorage => {
|
|
type => 'File',
|
|
dirName => '/<span class=
|
|
"java-keyword">var</span>/lib/lemonldap-ng/notifications/',
|
|
},
|
|
</pre>
|
|
</div>
|
|
|
|
<h3 class="heading-1-1"><span id="HUsingnotificationsystem">Using
|
|
notification system</span></h3>
|
|
|
|
<h4 class="heading-1-1-1"><span id="HInsertnewnotifications">Insert new
|
|
notifications</span></h4>
|
|
|
|
<p class="paragraph"></p>New notifications can be insert using SOAP
|
|
request (described in the WSDL file generated by buildPortalWSDL tool).
|
|
|
|
<h5 class="heading-1-1-1-1"><span id="HNotificationformat">Notification
|
|
format</span></h5>
|
|
|
|
<p class="paragraph"></p>Notifications are XML files containing :
|
|
|
|
<ul class="star">
|
|
<li>"<notification>" element(s) :
|
|
|
|
<ul class="star">
|
|
<li>required attributes :
|
|
|
|
<ul class="star">
|
|
<li>"date" in format YYYY-MM-DD</li>
|
|
|
|
<li>"ref" : a reference that can be used later to know what has
|
|
been notified and when</li>
|
|
|
|
<li>"uid" : the user (it must correspond to the attibute set in
|
|
whatToTrace parameter : uid by default)</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li>sub-elements :
|
|
|
|
<ul class="star">
|
|
<li><text> : paragraph to display : inserted in HTML page
|
|
enclosed in <p class="notifText">...</p>)</li>
|
|
|
|
<li><check> : paragraph to display with a checkbox :
|
|
inserted in HTML page enclosed in <p
|
|
class="notifCheck"><input
|
|
type="checkbox/>...</p></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>All other elements will be removed including HTML elemants like
|
|
<b>
|
|
|
|
<p class="paragraph"></p>Example :
|
|
|
|
<div class="code">
|
|
<pre>
|
|
<?xml version=<span class="java-quote">"1.0"</span> encoding=<span class=
|
|
"java-quote">"UTF-8"</span> standalone=<span class=
|
|
"java-quote">"no"</span>?>
|
|
<root>
|
|
<notification uid=<span class=
|
|
"java-quote">"foo.bar"</span> date=<span class=
|
|
"java-quote">"2009-01-27"</span> reference=<span class=
|
|
"java-quote">"ABC"</span>>
|
|
<text> You have been granted to access to appli-1 </text>
|
|
<text> You have been granted to access to appli-2 </text>
|
|
<check> I know that I can acces to appli-1 </check>
|
|
<check> I know that I can acces to appli-2 </check>
|
|
</notification>
|
|
</root>
|
|
</pre>
|
|
</div>
|
|
|
|
<h5 class="heading-1-1-1-1"><span id="HInsertionexampleinPerl">Insertion
|
|
example in Perl</span></h5>
|
|
|
|
<p class="paragraph"></p>
|
|
|
|
<div class="code">
|
|
<pre>
|
|
#!/usr/bin/perl<br /><br />use SOAP::Lite;
|
|
use utf8;<br /><br />my $lite = SOAP::Lite
|
|
->uri('urn:Lemonldap::NG::Common::CGI::SOAPService')
|
|
->proxy('http://auth.example.com/index.pl/notification');<br /><br />$r = $lite->newNotification('<?xml version=<span class="java-quote">"1.0"</span> encoding=<span class="java-quote">"UTF-8"</span> standalone=<span class="java-quote">"no"</span>?>
|
|
<root>
|
|
<notification uid=<span class=
|
|
"java-quote">"foo.bar"</span> date=<span class=
|
|
"java-quote">"2009-01-27"</span> reference=<span class=
|
|
"java-quote">"ABC"</span>>
|
|
<text> You have been granted to access to appli-1 </text>
|
|
<text> You have been granted to access to appli-2 </text>
|
|
<check> I know that I can acces to appli-1 </check>
|
|
<check> I know that I can acces to appli-2 </check>
|
|
</notification>
|
|
</root>');<br /><br /><span class=
|
|
"java-keyword">if</span> ( $r->fault ) {
|
|
print STDERR <span class=
|
|
"java-quote">"SOAP Error: "</span> . $r->fault->{faultstring};
|
|
}
|
|
<span class="java-keyword">else</span> {
|
|
my $res = $r->result();
|
|
print "$res notification(s) have been inserted";
|
|
}
|
|
</pre>
|
|
</div>
|
|
|
|
<h4 class="heading-1-1-1"><span id="HTestnotification">Test
|
|
notification</span></h4>
|
|
|
|
<p class="paragraph"></p>You've simply to insert a notification and
|
|
connect to the portal using the same UID. You will be prompted.
|
|
</div>
|
|
|
|
<p class="footer"><a href="index.html">Index</a></p>
|
|
</body>
|
|
</html>
|