Notification system

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.

Installation

Activation

You just have to set "notification => 1" in the portal.

Storage

By default, notifications will be stored in the same database as configuration :
CREATE TABLE 'notifications' (
  'date' datetime NOT NULL,
  'uid' varchar(255) NOT NULL,
  'ref' varchar(255) NOT NULL,
  'xml' longblob NOT NULL,
  'done' datetime default NULL,
  PRIMARY KEY  ('date','uid','ref')
)

You can change default parameters using the "notificationStorage" parameter with the same syntax as configStorage. Example :
notificationStorage => {
     type    => 'File',
     dirName => '/var/lib/lemonldap-ng/notifications/',
 },

Using notification system

Insert new notifications

New notifications can be insert using SOAP request (described in the WSDL file generated by buildPortalWSDL tool).
Notification format

Notifications are XML files containing : All other elements will be removed including HTML elemants like <b>

Example :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<notification uid="foo.bar" date="2009-01-27" reference="ABC">
<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>
Insertion example in Perl

#!/usr/bin/perl

use SOAP::Lite; use utf8;

my $lite = SOAP::Lite ->uri('urn:Lemonldap::NG::Common::CGI::SOAPService') ->proxy('http://auth.example.com/index.pl/notification');

$r = $lite->newNotification('<?xml version="1.0" encoding="UTF-8" standalone="no"?> <root> <notification uid="foo.bar" date="2009-01-27" reference="ABC"> <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>');

if ( $r->fault ) { print STDERR "SOAP Error: " . $r->fault->{faultstring}; } else { my $res = $r->result(); print "$res notification(s) have been inserted"; }

Test notification

You've simply to insert a notification and connect to the portal using the same UID. You will be prompted.