[midPoint] midPoint Digest, Vol 124, Issue 17

Pavol Mederly mederly at evolveum.com
Mon Aug 15 15:08:39 CEST 2022


Hello Jean Michel,

yes, policy rules have been created just for this kind of needs.

Especially, there is a "transition" kind of policy constraint that fires 
if it sees a change from defined state S1 to another defined state S2: 
https://github.com/Evolveum/midpoint/blob/187bdb434b9b9524ce3a01849a137da7a2b261f0/infra/schema/src/main/resources/xml/ns/public/common/common-policy-3.xsd#L317-L332

Some examples of its use are in this file: 
https://github.com/Evolveum/midpoint/blob/187bdb434b9b9524ce3a01849a137da7a2b261f0/model/model-impl/src/test/resources/lens/policy/role-student.xml

(But they are quite complex.)

The file is used in this test: 
https://github.com/Evolveum/midpoint/blob/187bdb434b9b9524ce3a01849a137da7a2b261f0/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestPolicyRules2.java

--

This feature is quite an experimental one, with (as I said) very sketchy 
documentation. In short: it is there, should be functional, but to be 
100% polished it needs someone who would invest some money in it. 
Anyway, you can give it a try, maybe it would be OK for you.

Best regards,

-- 
Pavol Mederly
Software developer
evolveum.com

On 15/08/2022 14:47, Jean Michel Santos via midPoint wrote:
> Hello,
>
> First of all, very sorry about the spam messages, my email client was not OK that day.
>
> Imagine a scenario when you need to provide a new role, or notify the user manager, when the job code changes for a user. But not for all job codes, an specific one, like 001 to 003.
>
> So, to compare I need to get the old value (001), and then compare with the new value(003) and if is true, take the  properly action to this rule.
>
> Thanks in advance.
>
> Regards,
> Jean Santos
>
> midpoint-request at lists.evolveum.com wrote:
>> Send midPoint mailing list submissions to
>> 	midpoint at lists.evolveum.com
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	https://lists.evolveum.com/mailman/listinfo/midpoint
>> or, via email, send a message with subject or body 'help' to
>> 	midpoint-request at lists.evolveum.com
>>
>> You can reach the person managing the list at
>> 	midpoint-owner at lists.evolveum.com
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of midPoint digest..."
>>
>> Today's Topics:
>>
>>    1. How to compare old with new value in Midpoint (Jean Santos)
>>    2. How to compare old with new value in Midpoint (Jean Santos)
>>    3. How to compare old with new value in Midpoint (Jean Michel Santos)
>>    4. Re: How to compare old with new value in Midpoint (Pavol Mederly)
>>    5. Re: How to compare old with new value in Midpoint (Pavol Mederly)
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 12 Aug 2022 10:14:38 -0300
>> From: Jean Santos <jean.michel at ebz.tec.br>
>> To: "=?utf-8?Q?midpoint=40lists.evolveum.com?="
>> 	<midpoint at lists.evolveum.com>
>> Subject: [midPoint] How to compare old with new value in Midpoint
>> Message-ID: <AF43F875-ECFA-4EC7-A0C9-CF2CD5315FA8 at getmailspring.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Community,
>>
>> In some cases, we need to compare the old and the new value(s) from an attribute to make a decision, I saw that when we're tracing in a mapping, we're able to see both values in the log. However, I don't know yet how to get those values inside a expression or condition and make a way to compare then.
>> Could you please help me out in this question?
>> Thanks in advance!
>> Best Regards,
>> Jean Michel Santos
>> EbZ Tecnologia
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220812/7f82e7bd/attachment-0002.htm>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Fri, 12 Aug 2022 10:17:00 -0300
>> From: Jean Santos <jean.michel at ebz.tec.br>
>> To: "=?utf-8?Q?midpoint=40lists.evolveum.com?="
>> 	<midpoint at lists.evolveum.com>
>> Subject: [midPoint] How to compare old with new value in Midpoint
>> Message-ID: <AF43F875-ECFA-4EC7-A0C9-CF2CD5315FA8 at getmailspring.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Community,
>>
>> In some cases, we need to compare the old and the new value(s) from an attribute to make a decision, I saw that when we're tracing in a mapping, we're able to see both values in the log. However, I don't know yet how to get those values inside a expression or condition and make a way to compare then.
>> Could you please help me out in this question?
>> Thanks in advance!
>> Best Regards,
>> Jean Michel Santos
>> EbZ Tecnologia
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220812/7f82e7bd/attachment-0003.htm>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Fri, 12 Aug 2022 13:19:08 -0000
>> From: "Jean Michel Santos" <jean.michel at ebz.tec.br>
>> To: midpoint at lists.evolveum.com
>> Subject: [midPoint] How to compare old with new value in Midpoint
>> Message-ID: <166031034859.1526.2424895894819339684 at mail.ebz>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Community,
>>
>> In some cases, we need to compare the old and the new value(s) from an attribute to make a decision, I saw that when we're tracing in a mapping, we're able to see both values in the log. However, I don't know yet how to get those values inside a expression or condition and make a way to compare then.
>>
>> Could you please help me out in this question?
>>
>> Thanks in advance!
>>
>> Best Regards,
>>
>> Jean Michel Santos
>> EbZ Tecnologia
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Sat, 13 Aug 2022 00:48:15 +0200
>> From: Pavol Mederly <mederly at evolveum.com>
>> To: midpoint at lists.evolveum.com
>> Subject: Re: [midPoint] How to compare old with new value in Midpoint
>> Message-ID: <1e5136ef-e566-9b58-1fa9-7ecdd4c17ff7 at evolveum.com>
>> Content-Type: text/plain; charset=UTF-8; format=flowed
>>
>> Hello Jean Michel,
>>
>> midPoint transparently works with old and new values, as explained e.g.
>> here:
>> https://docs.evolveum.com/midpoint/reference/expressions/mappings/mapping-relativity/.
>>
>> Isn't that sufficient for you? What is the use case where you need to
>> explicitly access (compare) old and new values?
>>
>> --
>>
>> Just for completeness, midPoint can process rules like "If a user
>> property changed from state S1 to state S2, execute action A". The
>> states can be specified as concrete values, or using arbitrary expression.
>>
>> This feature is called "Policy rules". Although it works quite well, it
>> is not documented enough (yet). See
>> https://docs.evolveum.com/midpoint/reference/roles-policies/policy-rules/.
>>
>> --
>>
>> Best regards,
>>
>> -- 
>> Pavol Mederly
>> Software developer
>> evolveum.com
>>
>> On 12/08/2022 15:19, Jean Michel Santos via midPoint wrote:
>> > Hi Community,
>> >
>> > In some cases, we need to compare the old and the new value(s) from an attribute to make a decision, I saw that when we're tracing in a mapping, we're able to see both values in the log. However, I don't know yet how to get those values inside a expression or condition and make a way to compare then.
>> >
>> > Could you please help me out in this question?
>> >
>> > Thanks in advance!
>> >
>> > Best Regards,
>> >
>> > Jean Michel Santos
>> > EbZ Tecnologia
>> > _______________________________________________
>> > midPoint mailing list
>> > midPoint at lists.evolveum.com
>> > https://lists.evolveum.com/mailman/listinfo/midpoint
>>
>> ------------------------------
>>
>> Message: 5
>> Date: Sat, 13 Aug 2022 09:20:57 +0200
>> From: Pavol Mederly <mederly at evolveum.com>
>> To: midpoint at lists.evolveum.com
>> Subject: Re: [midPoint] How to compare old with new value in Midpoint
>> Message-ID: <c72e28b9-9f9e-1b82-0a4d-b25f8ef44048 at evolveum.com>
>> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>>
>> Jean Michel,
>>
>> there is a dirty hack that could be used as a last resort:
>>
>> The properties *modelContext.focusContext.objectOld*, *.objectCurrent*,
>> and *.objectNew* provide old, current, and new (expected) values of the
>> focus object, respectively.
>>
>> There you can find old/new values of the user property, and act upon them.
>>
>> But it is strongly recommended to *NOT* do so. Among the reasons is that
>> it creates the dependency of your design on the internal midPoint
>> workings that can change anytime. Also, the use of these
>> undocumented/internal mechanisms may provide unexpected results in some
>> situations.
>>
>> The best way forward is to exploit supported midPoint features and - if
>> needed - discuss with us about their potential extension to cover your
>> needs.
>>
>> Best regards,
>>
>> -- 
>> Pavol Mederly
>> Software developer
>> evolveum.com
>>
>> On 13/08/2022 00:48, Pavol Mederly via midPoint wrote:
>> > Subject:
>> > Re: [midPoint] How to compare old with new value in Midpoint
>> > From:
>> > Pavol Mederly via midPoint <midpoint at lists.evolveum.com>
>> > Date:
>> > 13/08/2022, 00:48
>> >
>> > To:
>> > midpoint at lists.evolveum.com
>> > CC:
>> > Pavol Mederly <mederly at evolveum.com>
>> >
>> >
>> > Hello Jean Michel,
>> >
>> > midPoint transparently works with old and new values, as explained
>> > e.g. here:
>> > https://docs.evolveum.com/midpoint/reference/expressions/mappings/mapping-relativity/.
>> >
>> >
>> > Isn't that sufficient for you? What is the use case where you need to
>> > explicitly access (compare) old and new values?
>> >
>> > --
>> >
>> > Just for completeness, midPoint can process rules like "If a user
>> > property changed from state S1 to state S2, execute action A". The
>> > states can be specified as concrete values, or using arbitrary
>> > expression.
>> >
>> > This feature is called "Policy rules". Although it works quite well,
>> > it is not documented enough (yet). See
>> > https://docs.evolveum.com/midpoint/reference/roles-policies/policy-rules/.
>> >
>> >
>> > --
>> >
>> > Best regards,
>> >
>> > --
>> > Pavol Mederly
>> > Software developer
>> > evolveum.com
>> >
>> > On 12/08/2022 15:19, Jean Michel Santos via midPoint wrote:
>> >> Hi Community,
>> >>
>> >> In some cases, we need to compare the old and the new value(s) from
>> >> an attribute to make a decision, I saw that when we're tracing in a
>> >> mapping, we're able to see both values in the log. However, I don't
>> >> know yet how to get those values inside a expression or condition and
>> >> make a way to compare then.
>> >>
>> >> Could you please help me out in this question?
>> >>
>> >> Thanks in advance!
>> >>
>> >> Best Regards,
>> >>
>> >> Jean Michel Santos
>> >> EbZ Tecnologia
>> >> _______________________________________________
>> >> midPoint mailing list
>> >> midPoint at lists.evolveum.com
>> >> https://lists.evolveum.com/mailman/listinfo/midpoint
>> > _______________________________________________
>> > midPoint mailing list
>> > midPoint at lists.evolveum.com
>> > https://lists.evolveum.com/mailman/listinfo/midpoint
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220813/d01583f1/attachment-0001.htm>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>
>> ------------------------------
>>
>> End of midPoint Digest, Vol 124, Issue 17
>> *****************************************
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint


More information about the midPoint mailing list