<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 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.
You just have to activate Notifications in the Manager (General Parameters > Advanced Parameters > Notifications > Activation) or in lemonldap-ng.ini:
By default, notifications will be stored in the same database as configuration:
</p>
<ul>
<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>
</li>
<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>
</li>
<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>
</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 > Advanced Parameters > Notifications.
</p>
</div>
<h4id="file">File</h4>
<divclass="level4">
<p>
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 the server for inserting notifications is paired with the 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"> condition: condition to display the notification, can use all session variables.</div>
</li>
</ul>
</li>
<liclass="level2"><divclass="li"> Sub elements:</div>
<ul>
<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>
</li>
<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>
</li>
<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>
</li>
<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>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<divclass="noteimportant">All other elements will be removed including <abbrtitle="HyperText Markup Language">HTML</abbr> elements like <b>.
</div><divclass="notetip">One notification XML document can contain several notifications messages.
<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>
New JSON notifications can be inserted using REST or SOAP server. 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>.
</p>
<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>
<spanclass="br0">}</span></pre>
<p>
You can also delete some notifications with SOAP, once SOAP is activated:
</p>
</div>
<h4id="deletion_example_in_perl">Deletion example in Perl</h4>
<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>