<liclass="level2"><divclass="li"><ahref="#create_new_notifications_with_notifications_explorer">Create new notifications with notifications explorer</a></div></li>
Since version 0.9.4, LemonLDAP::NG can be used to notify some messages to users: if a user has got messages, they will be displayed when he access to the portal. If a message contains some check boxes, the user has to check all of them else he can not access to the portal and retrieves his session cookie.
Since 1.1.0, a notification explorer is available in Manager, and notifications can be set for all users, with possibility to use display conditions. When the user accept the notification, notification reference is stored in his persistent session.
You just have to activate Notifications in the Manager (General Parameters > Advanced Parameters > Notifications > Activation) or in <code>lemonldap-ng.ini</code> [portal] section:
<liclass="level1"><divclass="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>
<liclass="level1"><divclass="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>
<liclass="level1"><divclass="li"> if you use "LDAP" system, the notifications will be stored in the same directory as configuration and in a branch called "notifications".</div>
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 > Advanced Parameters > Notifications.
Parameters for File backend are the same as <ahref="fileconfbackend.html"class="wikilink1"title="documentation:2.0:fileconfbackend">File configuration backend</a>.
</p>
<divclass="noteimportant">You need to create yourself the directory and set write access to Apache user. For example:
</div><divclass="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>
<liclass="level1"><divclass="li"><strong>dirName</strong>: directory where notifications are stored.</div>
</li>
<liclass="level1"><divclass="li"><strong>fileNameSeparator</strong>: file name separator.</div>
</li>
</ul>
</div>
<h4id="dbi">DBI</h4>
<divclass="level4">
<p>
Parameters for <abbrtitle="Database Interface">DBI</abbr> backend are the same as <ahref="sqlconfbackend.html"class="wikilink1"title="documentation:2.0:sqlconfbackend">DBI configuration backend</a>.
</p>
<divclass="noteimportant">You have to create the table by yourself:
Parameters for LDAP backend are the same as <ahref="ldapconfbackend.html"class="wikilink1"title="documentation:2.0:ldapconfbackend">LDAP configuration backend</a>.
</p>
<divclass="noteimportant">You have to create the branch by yourself
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.
To change it, go in General Parameters > Advanced Parameters > Notifications > 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.
<divclass="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 notification server depends on chosen format: REST for JSON and SOAP for XML.
<liclass="level3"><divclass="li"> date: creation date (format YYYY-MM-DD)</div>
</li>
<liclass="level3"><divclass="li"> ref: a reference that can be used later to know what has been notified and when</div>
</li>
<liclass="level3"><divclass="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>
<liclass="level3"><divclass="li"><title>: title to display: will be inserted in <abbrtitle="HyperText Markup Language">HTML</abbr> page enclosed in <h2 class="notifText">...</h2></div>
<liclass="level3"><divclass="li"><subtitle>: subtitle to display: will be inserted in <abbrtitle="HyperText Markup Language">HTML</abbr> page enclosed in <h2 class="notifText">...</h2></div>
<liclass="level3"><divclass="li"><text>: paragraph to display: will be inserted in <abbrtitle="HyperText Markup Language">HTML</abbr> page enclosed in <p class="notifText">...</p></div>
<liclass="level3"><divclass="li"><check>: paragraph to display with a checkbox: will be inserted in <abbrtitle="HyperText Markup Language">HTML</abbr> page enclosed in <p class="notifCheck"><input type="checkbox" />...</p></div>
<spanclass="st0">"title"</span><spanclass="sy0">:</span><spanclass="st0">"You have new authorizations"</span><spanclass="sy0">,</span>
<spanclass="st0">"text"</span><spanclass="sy0">:</span><spanclass="st0">"You have been granted to access to appli-1"</span><spanclass="sy0">,</span>
<spanclass="sc3"><spanclass="re1"><title<spanclass="re2">></span></span></span>You have new authorizations<spanclass="sc3"><spanclass="re1"></title<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><text<spanclass="re2">></span></span></span>You have been granted to access to appli-1<spanclass="sc3"><spanclass="re1"></text<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><text<spanclass="re2">></span></span></span>You have been granted to access to appli-2<spanclass="sc3"><spanclass="re1"></text<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><check<spanclass="re2">></span></span></span>I know that I can access to appli-1 <spanclass="sc3"><spanclass="re1"></check<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><check<spanclass="re2">></span></span></span>I know that I can access to appli-2 <spanclass="sc3"><spanclass="re1"></check<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><title<spanclass="re2">></span></span></span>This is your first access on this system<spanclass="sc3"><spanclass="re1"></title<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><text<spanclass="re2">></span></span></span>Be a nice user and do not break it please.<spanclass="sc3"><spanclass="re1"></text<spanclass="re2">></span></span></span>
<spanclass="sc3"><spanclass="re1"><check<spanclass="re2">></span></span></span>Of course I am not evil!<spanclass="sc3"><spanclass="re1"></check<spanclass="re2">></span></span></span>
LemonLDAP::NG provides two notification servers : SOAP and REST depending on format.
</p>
<p>
If enabled, the server <abbrtitle="Uniform Resource Locator">URL</abbr> is <ahref="https://auth.your.domain/notifications"class="urlextern"title="https://auth.your.domain/notifications"rel="nofollow">https://auth.your.domain/notifications</a>.
<divclass="noteimportant">If notification server is enabled, you have to protect this <abbrtitle="Uniform Resource Locator">URL</abbr> using the webserver because there is no authentication required to use it.
<ahref="http://perldoc.perl.org/functions/print.html"><spanclass="kw3">print</span></a><spanclass="st0">"$res notification(s) have been inserted<spanclass="es0">\n</span>"</span><spanclass="sy0">;</span>
<ahref="http://perldoc.perl.org/functions/print.html"><spanclass="kw3">print</span></a><spanclass="st0">"$res notification(s) have been deleted<spanclass="es0">\n</span>"</span><spanclass="sy0">;</span>
REST server provides three <abbrtitle="Application Programming Interface">API</abbr> to insert (POST), delete (DELETE) or list (GET) notification(s).
HTTP methods can enabled/disabled in Manager, <code>General Parameters</code> » <code>Plugins</code> » <code>Notifications</code> » <code>Server</code> » <code>HTTP methods</code>.
</p>
<p>
Notifications parameters returned by <code>GET</code> method can be specfied in Manager, <code>General Parameters</code> » <code>Plugins</code> » <code>Notifications</code> » <code>Server</code> » <code>Notifications parameters to send</code>. By default: 'uid reference date title subtitle text check'
</p>
</div>
<h5id="insertion_example_with_rest_api">* Insertion example with REST API</h5>