[midPoint] Fwd: SMS Notification

Jason Everling jeverling at bshp.edu
Mon Mar 6 16:24:42 CET 2017


That is beyond my scope, I have never used it for roles, only activation
and attribute values

You could use event.isRelatedToItem, I briefly tested it, although, it will
also fire for any assignment so I am sure it can be further set to roles
only but I wouldn't know

      <handler>
         <expressionFilter>
            <script>
               <code>
event.isRelatedToItem(new com.evolveum.midpoint.prism.
path.ItemPath("assignment"))
                </code>
            </script>
         </expressionFilter>
         <simpleUserNotifier>

Maybe someone has done it before and will respond, but for now, that above
seems to work. The docs are below.

<goog_223859929>
https://www.evolveum.com/downloads/midpoint/3.4.1/midpoint-3.4.1-javadoc/com/evolveum/midpoint/prism/path/ItemPath.html

JASON

On Mon, Mar 6, 2017 at 2:55 AM, mceylan <mrveceylan at gmail.com> wrote:

> hi Jason,
>
> Could you help me write code to filter by role changes?
> I did not succeed in the event part :(
>
> Thank you
>
>
>
>
> 2017-03-03 10:35 GMT+02:00 mceylan <mrveceylan at gmail.com>:
>
>> hi,
>>
>> notification configuration add
>>
>>
>>  <bodyExpression>         <!-- Body expression is defined here -->
>>                 <script>
>>                    <code>            <!-- Some imports needed to have
>> all necessary objects and variables -->
>>                    import com.evolveum.midpoint.notifica
>> tions.impl.notifiers.GeneralNotifier;
>>                    import com.evolveum.midpoint.notifica
>> tions.api.events.ModelEvent;
>>                    import com.evolveum.midpoint.prism.delta.ObjectDelta;
>>                    delta = ObjectDelta.summarize(((ModelEvent)
>> event).getFocusDeltas());
>>                    hiddenPaths = GeneralNotifier.getAuxiliaryPaths()
>>                    body = ''
>>                    attemptedTo = event.isSuccess() ? "" : "(attempted to
>> be) ";
>>                    if (delta.isAdd()) {
>>                        body = "The object was " + attemptedTo + "created
>> with the following data:\n";
>>                        body += textFormatter.formatObject(delta.getObjectToAdd(),
>> hiddenPaths, false);
>>                    }
>>                    </code>
>>                </script>
>>            </bodyExpression>
>>
>>
>>
>> error log file:
>>
>>
>> com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
>> groovy.lang.MissingMethodException: No signature of method: static
>> com.evolveum.midpoint.notifications.impl.notifiers.GeneralNotifier.getAuxiliaryPaths()
>> is applicable for argument types: () values: [] (new) body expression
>>
>> 2017-03-02 17:48 GMT+02:00 Jason Everling <jeverling at bshp.edu>:
>>
>>> Within the first section, <expressionFilter> , is where you have to
>>> create a filter to watch for role changes, I am sorry though, that code is
>>> beyond me or what I have ever done.
>>>
>>> <handler>
>>>          <expressionFilter>
>>>             <script>
>>>                <code>
>>>      code to filter by role changes...
>>>                 </code>
>>>             </script>
>>>          </expressionFilter>
>>>
>>> and within the body expression is where you need to code what you want
>>> to have in the message, for example
>>>
>>> <bodyExpression>
>>>                <script>
>>>                   <code>
>>> body = "Account modified:" + requestee?.getName()?.getOrig()
>>>                     </code>
>>>                </script>
>>> </bodyExpression>
>>>
>>> JASON
>>>
>>> On Thu, Mar 2, 2017 at 6:44 AM, mceylan <mrveceylan at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I can send sms when I make an account change, but the same message goes
>>>> by default. No detailed message is going.
>>>>
>>>>
>>>> Message{to='054355444543544]', subject='[IDM] SUCCESS: User MODIFY
>>>> operation succeeded for test', contentType='null', body='Notification about
>>>> user-related operation (status: SUCCESS)
>>>>
>>>>
>>>> For example, I want you to be given a new role when you change roles.
>>>>
>>>> Thanks,
>>>>
>>>>
>>>> 2017-03-01 19:05 GMT+02:00 Pavol Mederly <mederly at evolveum.com>:
>>>>
>>>>> Hello Jason,
>>>>>
>>>>> I think you are right. It should work. (Haven't tried it myself as
>>>>> well, though).
>>>>>
>>>>> Pavol Mederly
>>>>> Software developerevolveum.com
>>>>>
>>>>> On 01.03.2017 17:14, Jason Everling wrote:
>>>>>
>>>>> You would have to use the simpleUserNotifier for that and add sms as
>>>>> the transport but I have never used it before, maybe someone else would
>>>>> know if it works with sms? You could then use an expression filter so that
>>>>> it only gets sent to specific users based on some common attribute, more
>>>>> info here on how or what can be added,
>>>>>
>>>>> https://wiki.evolveum.com/display/midPoint/Configuring+notifications
>>>>>
>>>>>       <handler>
>>>>>          <expressionFilter>
>>>>>             <script>
>>>>>                <code>
>>>>>     code to filter by role changes...
>>>>>                 </code>
>>>>>             </script>
>>>>>          </expressionFilter>
>>>>>          <simpleUserNotifier>
>>>>>             <name>Account Modified</name>
>>>>>             <status>success</status>
>>>>>             <recipientExpression>
>>>>>                <script>
>>>>>                   <code>requestee.getTelephoneNumber()</code>
>>>>>                </script>
>>>>>             </recipientExpression>
>>>>>             <subjectExpression>
>>>>>                <script>
>>>>>                   <code>
>>>>> subject code
>>>>> </code>
>>>>>                </script>
>>>>>             </subjectExpression>
>>>>>             <bodyExpression>
>>>>>                <script>
>>>>>                   <code>
>>>>> body code
>>>>>                     </code>
>>>>>                </script>
>>>>>             </bodyExpression>
>>>>>             <transport>sms</transport>
>>>>>          </simpleUserNotifier>
>>>>>       </handler>
>>>>>
>>>>> JASON
>>>>>
>>>>> On Tue, Feb 28, 2017 at 9:49 AM, mceylan <mrveceylan at gmail.com> wrote:
>>>>>
>>>>>> Thanks Jason, I did it before the answer came :)
>>>>>>
>>>>>> So, how do I send changes to certain users' accounts with sms?  For
>>>>>> example, let us know when a new role is assigned.
>>>>>>
>>>>>> I will send the information to the users to be identified. How can I
>>>>>> do that. With the role?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> 2017-02-28 17:08 GMT+03:00 Jason Everling <jeverling at bshp.edu>:
>>>>>>
>>>>>>> I have never used anything outside of what I posted, but in a
>>>>>>> standard notification you add the parts, you could try,
>>>>>>>
>>>>>>> + requestee?.getName()?.getOrig() which is the username and  +
>>>>>>> midpoint.getPlaintextUserPassword(requestee) is the password of the
>>>>>>> account being changed.
>>>>>>>
>>>>>>> Within our notification I get the username and password with +
>>>>>>> encodedMessageText , it displays the below. Can you post what you get from
>>>>>>> the sms-notifications log
>>>>>>>
>>>>>>> 'Password for user tauser2 is: n3wPassw0rd'
>>>>>>>
>>>>>>> JASON
>>>>>>>
>>>>>>> On Tue, Feb 28, 2017 at 12:26 AM, mceylan <mrveceylan at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Gustav, I enter real information in the live system. I did not
>>>>>>>> want to write Mail. Because, gateway real username and password.
>>>>>>>>
>>>>>>>> There is no problem sending SMS. The problem is to send the
>>>>>>>> username and password of the user I created in sms and to inform when the
>>>>>>>> account is changed
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>>
>>>>>>>> 2017-02-28 7:58 GMT+02:00 Pálos Gustáv <gustav.palos at evolveum.com>:
>>>>>>>>
>>>>>>>>> Hi Merve,
>>>>>>>>>
>>>>>>>>> username and password are not variables, are you REAL username and
>>>>>>>>> REAL password, please replace it like this:
>>>>>>>>> http:/my-gateway/api/v3/sendsms/plain?user=palos&passwor
>>>>>>>>> d=abcd123X&sender=XX....
>>>>>>>>>
>>>>>>>>> Gustav
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2017-02-28 6:49 GMT+01:00 mceylan <mrveceylan at gmail.com>:
>>>>>>>>>
>>>>>>>>>> Hi Jason,
>>>>>>>>>>
>>>>>>>>>> The message I wrote in EncodedMessageText comes up but the
>>>>>>>>>> username and password do not come up. How can I send those variables in the
>>>>>>>>>> script
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <handler>
>>>>>>>>>>          <userPasswordNotifier>
>>>>>>>>>>             <recipientExpression>
>>>>>>>>>>                <script>
>>>>>>>>>>                   <code>requestee.getTelephoneNumber()</code>
>>>>>>>>>>                </script>
>>>>>>>>>>             </recipientExpression>
>>>>>>>>>>             <transport>sms</transport>
>>>>>>>>>>          </userPasswordNotifier>
>>>>>>>>>>       </handler>
>>>>>>>>>>       <sms>
>>>>>>>>>>          <gateway>
>>>>>>>>>>             <url>
>>>>>>>>>>                <script>
>>>>>>>>>>                   <code>"http:/my-gateway/api/v3
>>>>>>>>>> /sendsms/plain?user=username&password=password&sender=XX"
>>>>>>>>>> + "&GSM=" + to + "&text=" + "account"</code>
>>>>>>>>>>                </script>
>>>>>>>>>>             </url>
>>>>>>>>>>          </gateway>
>>>>>>>>>>       </sms>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> log
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> send to message "account"
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>> 2017-02-28 2:28 GMT+02:00 Jason Everling <jeverling at bshp.edu>:
>>>>>>>>>>
>>>>>>>>>>> If you are testing SMS then yes, use a test account with your
>>>>>>>>>>> phone number.
>>>>>>>>>>>
>>>>>>>>>>> JASON
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Feb 27, 2017 at 1:57 AM, mceylan <mrveceylan at gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> thanks Jason, no problem. There will be another responsibility.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> For changes made to specific users' accounts, SMS will be
>>>>>>>>>>>> provided to the user. Do I submit changes to my account?   Can I also send
>>>>>>>>>>>> a username and password?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>
>>>>>>>>>>>> 2017-02-23 17:28 GMT+02:00 Jason Everling <jeverling at bshp.edu>:
>>>>>>>>>>>>
>>>>>>>>>>>>> Maybe try the below, your sms code has changed a few times
>>>>>>>>>>>>> between your messages, GSM= I am assuming is the phone number to send
>>>>>>>>>>>>>
>>>>>>>>>>>>> <notificationConfiguration>
>>>>>>>>>>>>> <handler>
>>>>>>>>>>>>> <userPasswordNotifier>
>>>>>>>>>>>>> <recipientExpression>
>>>>>>>>>>>>> <script>
>>>>>>>>>>>>> <code>
>>>>>>>>>>>>>              requestee.getTelephoneNumber()
>>>>>>>>>>>>>             </code>
>>>>>>>>>>>>> </script>
>>>>>>>>>>>>> </recipientExpression>
>>>>>>>>>>>>> <transport>sms</transport>
>>>>>>>>>>>>> </userPasswordNotifier>
>>>>>>>>>>>>> </handler>
>>>>>>>>>>>>> <sms>
>>>>>>>>>>>>> <gateway>
>>>>>>>>>>>>> <url>
>>>>>>>>>>>>> <script>
>>>>>>>>>>>>> <code>"http://my-gateway/api/v3/sendsms/plain?user=USERNAME&
>>>>>>>>>>>>> amp;password=PASSWORD&SMSText=" + encodedMessageText +
>>>>>>>>>>>>> "&GSM=" + to</code>
>>>>>>>>>>>>> </script>
>>>>>>>>>>>>> </url>
>>>>>>>>>>>>> </gateway>
>>>>>>>>>>>>> </sms>
>>>>>>>>>>>>>
>>>>>>>>>>>>> JASON
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Feb 23, 2017 at 9:06 AM, Jason Everling <
>>>>>>>>>>>>> jeverling at bshp.edu> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> I don't see a part in your gateway code that contains the
>>>>>>>>>>>>>> 'to' field , how does it know which phone to send the message to?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Some where in there you should have + to  and also +
>>>>>>>>>>>>>> encodedMessageText
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The 'to' variable is what requestee.getTelephoneNumber()
>>>>>>>>>>>>>> returns and encodedMessageText variable returns the message,
>>>>>>>>>>>>>> password in the case of userPasswordNotifier, which mine sends by default,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> '================ Wed Feb 22 08:43:21 CST 2017 =======
>>>>>>>>>>>>>> Message{to='[12107654321 <%28210%29%20765-4321>]',
>>>>>>>>>>>>>> subject='User password notification', contentType='null', body='Password
>>>>>>>>>>>>>> for user tauser2 is: s0m3passW0rd'}
>>>>>>>>>>>>>> '
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Somewhere in this url you have to have the 'to' variable,
>>>>>>>>>>>>>> don't know which gateway you are using so I cant tell you how it is used
>>>>>>>>>>>>>> and where to insert it,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> "http://my-gateway/api/v3/sendsms/plain?user=USERNAME&pa
>>>>>>>>>>>>>> ssword=PASSWORD&sender=SIFRE&SMSText=test123&" +
>>>>>>>>>>>>>> "&text=" + "deneme"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> midPoint mailing list
>>>>>>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Merve CEYLAN
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> midPoint mailing list
>>>>>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> midPoint mailing list
>>>>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Merve CEYLAN
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> midPoint mailing list
>>>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> s pozdravom
>>>>>>>>>
>>>>>>>>> Gustáv Pálos
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Gustáv Pálos
>>>>>>>>> Identity Engineer
>>>>>>>>> evolveum.com
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> midPoint mailing list
>>>>>>>>> midPoint at lists.evolveum.com
>>>>>>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Merve CEYLAN<
>>>>>>>>
>>>>>>> ...
>
> [Message clipped]
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170306/2d0df7bb/attachment.htm>


More information about the midPoint mailing list