[midPoint] Email Notification

Ivan Noris ivan.noris at evolveum.com
Fri Oct 24 09:08:11 CEST 2014


Hi Jason,


> Ah ok, so the GeneralNotifier is more or less what I would use then so
> I could customize the message and such, more testing and reading.
>
> I was taking a look at the code on github for those notifiers and I
> think I could go in and change some stuff if I cannot get the general
> notifier to work like I would like it.
>
> Would there happen to be any samples for the General Notifier
> anywhere, maybe complex or one's that have the body? I see the simple
> and others which I have gotten to work but I would like to customize
> the body and such so the general might be what I am looking for.

Everything I ever needed was doable using the "standard" notifiers. I'm
using something like this:

1. notification when User/Org/Role object is added/modified/deleted.
Sent to system administrators.
2. notification when User role is added - password is sent to system
administrators.
3. notification when Resource object (account, group, whatever) is
added/modified/deleted. Sent to system administrators.
4. notification when Resource Account is added - password is sent to
system administrators.

This covers all of my current requirements.
All notifications are sent to system administrators, this could be
changed of course, because the recipient expression is - well, expression.
All notifications are sent using SMTP (SSL/TLS).

Other-than-account support was added several months ago.
Other-than-User support was added couple of weeks ago.

I was experimenting with the General Notifier only before Org/Role
notifications were supported. After Pavol has implemented that, I got
rid of the General Notifier configuration.

Is there any specific feature that cannot be configured using our
standard notifiers (i.e. not the generalNotifier)?

FYI there is a comment in https://jira.evolveum.com/browse/MID-2045 that
might help you how the text in the General Notifier can be formatted.
Before that was implemented, my configuration for notification of
changes in OrgType was:

<handler>
   <generalNotifier>
   <name>Notify system administrator for organization change</name>
     <recipientExpression>
        <value>iamnotify at example.com</value>
     </recipientExpression>

     <expressionFilter>
         <script>
         <code>
import com.evolveum.midpoint.notifications.api.events.ModelEvent
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType

(event instanceof ModelEvent && event.getFocusContext() != null
&&
OrgType.class.isAssignableFrom(event.getFocusContext().getObjectTypeClass()))
         </code>
     </script>
     </expressionFilter>

     <subjectExpression>
       <script><code>

tmpObject = 'Organization '

if (event.isSuccess())
    tmpText = "[IDM] SUCCESS: " + tmpObject + event?.getChangeType() + "
operation succeeded"
else if (event.isFailure())
    tmpText = "[IDM] ERROR: " + tmpObject + event?.getChangeType() + "
operation failed"
else  tmpText = "[IDM] IN PROGRESS: " + tmpObject +
event?.getChangeType() + " operation in progress"

return tmpText
</code></script>
     </subjectExpression>

     <bodyExpression>
         <script>
         <code>return 'This notification will be enhanced. Stay
tuned.'</code>
     </script>
     </bodyExpression>

     <transport>mail</transport>

    </generalNotifier>
</handler>

As you see, the missing part at that time was the body of the email, it
can now be configured using the example from the JIRA referenced above.
But I believe that almost everything can now be configured using the
standard notifiers. Unless you have some very interesting use case, of
course.

Regards,
Ivan

-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer
  evolveum.com
  ___________________________________________
           "Idem per idem - semper idem Vix."




More information about the midPoint mailing list