Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:2.1:notifications [2019/11/19 16:54]
cmaudoux
documentation:2.1:notifications [2020/04/14 22:19] (current)
cmaudoux [Storage]
Line 6: Line 6:
  
 ===== Installation ===== ===== Installation =====
- 
 ==== Activation ==== ==== Activation ====
  
-You just have to activate Notifications in the Manager (General Parameters > Advanced Parameters > Notifications > Activation) or in ''​lemonldap-ng.ini''​ [portal] section:+You just have to activate Notifications in the Manager (General Parameters > Advanced Parameters > Notifications > Activation) 
 + 
 +or in ''​lemonldap-ng.ini''​ [portal] section:
 <file ini> <file ini>
 [portal] [portal]
Line 15: Line 16:
 </​file>​ </​file>​
  
-==== Storage ​====+==== Explorer ​==== 
 +Notifications explorer allows users to see and display theirs accepted notifications. Disable by default, you just have to activate it in the Manager (General Parameters > Advanced Parameters > Notifications > Explorer)
  
 +or in ''​lemonldap-ng.ini''​ [portal] section:
 +<file ini>
 +[portal]
 +notificationsExplorer = 1
 +</​file>​
 +
 +By default, just the three last notifications are displayed. You can modify this by editing ''​lemonldap-ng.ini''​ [portal] section:
 +<file ini>
 +[portal]
 +notificationsMaxRetrieve = 3
 +</​file>​
 +
 +=== Usage ===
 +When enabled, ''/​mynotifications''​ URL path is handled by this plugin.
 +
 +=== Known issue ===
 +An XML document can contain several notifications messages. Just the first one can be searched and displayed!
 +
 +<note important>​
 +Listed notifications are extracted from users persistent session (notification reference and accepted date).
 +ONLY the notifications explorer can found in notifications backend are available to be displayed.
 +Notifications content (title, subtitle and so on...) is not stored into persistent session.
 +</​note>​
 +==== Storage ====
 By default, notifications will be stored in the same database as configuration:​ By default, notifications will be stored in the same database as configuration:​
   * 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/​   * 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/​
Line 78: Line 104:
   * **ldapConfBase**:​ Notifications branch DN.   * **ldapConfBase**:​ Notifications branch DN.
  
 +<​note>​DBI configuration example:
 +<​code>​
 +notificationStorage = DBI
 +notificationStorageOptions={ ​ \
 +    '​dbiChain' ​   => '​DBI:​Pg:​dbname=llng;​host=mabdd;​port=5432',​ \
 +    '​dbiTable' ​   => '​notifications',​ \
 +    '​dbiUser' ​    => '​user',​ \
 +    '​dbiPassword'​ => '​qwerty',​ \
 +    '​type' ​       => '​CDBI',​ \
 +}
 +</​code>​
 +</​note>​
 ==== Wildcard ==== ==== Wildcard ====
  
Line 96: Line 134:
     * Required attributes:     * Required attributes:
       * date: creation date (format YYYY-MM-DD WITHOUT time!)       * date: creation date (format YYYY-MM-DD WITHOUT time!)
-      * ref: a reference that can be used later to know what has been notified and when+      * ref: a reference that can be used later to know what has been notified and when (Avoid ''​_''​ character)
       * uid: the user login (it must correspond to the attribute set in whatToTrace parameter, uid by default), or the wildcard string (by default: ''​allusers''​) if the notification should be displayed for every user.       * uid: the user login (it must correspond to the attribute set in whatToTrace parameter, uid by default), or the wildcard string (by default: ''​allusers''​) if the notification should be displayed for every user.
     * Optional attributes:     * Optional attributes:
Line 269: Line 307:
 } }
 </​code>​ </​code>​
- 
  
 === JSON notifications through REST === === JSON notifications through REST ===
Line 284: Line 321:
  
 == * Deletion example with REST API == == * Deletion example with REST API ==
 +DELETE API is available with LLNG ≥ 2.0.6
 +
 For example with curl: For example with curl:
 <​code>​ <​code>​
Line 290: Line 329:
  
 == * List example with REST API == == * List example with REST API ==
 +GET API is available with LLNG ≥ 2.0.6
 +
 For example with curl: For example with curl:
 <​code>​ <​code>​
 +# Retrieve '​wildcard'​ notifications
 curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications
  
 +# Retrieve all pending notifications
 +curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/​_allPending_
 +
 +# Retrieve all existing notifications
 +curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/​_allExisting_
 +
 +# Retrieve all <​uid>'​s notifications ​
 curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/<​uid>​ curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/<​uid>​
  
 +# Retrieve <​uid>/<​reference>​ notification parameters
 curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/<​uid>/<​reference>​ curl -X GET -H "​Content-Type:​ application/​json"​ -H "​Accept:​ application/​json"​ http://​auth.example.com/​notifications/<​uid>/<​reference>​
 </​code>​ </​code>​
- 
 ==== Test notification ==== ==== Test notification ====