Notification - set a notification when an extended attribute changes

This processor sets the value of original source before overwriting its value. In IdmFormInstance is this feature not available yet. It is needed for purpose of the next processor - will be removed, when original source is set by default in service.

The processor sends a notification about the change in the extended attribute to all who hold the role sets in the configuration. The configuration is handled by configuration properties.

Set all these properties in Settings → Configuration

idm.sec.core.event.notification.<Entity Type>.attributesNames=attr idm.sec.core.event.notification.<Entity Type>.roles=testNot

Entity Type here means a type of owner of the form definition. So when you need notification for an extended attribute of identity, then just put IdmIdentity there. See the picture below for example.

Next, we need some role and extended attribute. You can prepare those according to these tutorials. Role: https://wiki.czechidm.com/tutorial/adm/new_role Eav: https://wiki.czechidm.com/tutorial/adm/eav

It is up to you what will be in the message. Here is an example of a notification template for our usage. Put entity,eavValues in parameters and chose some name (we use testTemplateName) and subject.

<html>
<body>
<h3>Dobrý den,<br />
<br />
Na entitě <b>$entity.getUsername()</b> byly změněny monitorované extended attributy:<br /></h3>
<br />
#if( !$eavValues.isEmpty() )
#foreach( $field in $eavValues )
Položka: <b>$field.getName()</b>
<li>Původní hodnota: <b>$field.getOldValue().getValue().toString()</b></li>
<li>Nová hodnota: <b>$field.getNewValue().getValue().toString()</b></li>
<br />
#end
#end
S pozdravem CzechIdM.
<br />
<br />
-------------------------------------------------------------------------------------<br />
<h3>Hello,<br />
<br />
On entity <b>$entity.getUsername()</b> were changed monitored extended attributes:<br /></h3>
<br />
#if( !$eavValues.isEmpty() )
#foreach( $field in $eavValues )
Property: <b>$field.getName()</b>
<li>Original value: <b>$field.getOldValue().getValue().toString()</b></li>
<li>New value: <b>$field.getNewValue().getValue().toString()</b></li>
#end
#end
<br />
Regards CzechIdM.
</body>
</html>

* Notification → Configuration * Add - green button * Choose template with name: testTemplateName * Topic of notification is: core:<Entity Type>EavMonitoredFieldsChanged - for example core:IdmIdentityEavMonitoredFieldsChanged * Add other properties

Notification is sent only when something changes.

For the purpose of the message template, there is created a helpful entity. In this entity, you can get old value and new value. See the example template.

  • by klementm