Hi Mikael,
the SyncDelta processing was modified by SYNCOPE-1234 [1].
The new preprocess() method is invoked before any other method of the
provided implementation, giving clear chance to alter the data coming
from underlying resource prior to any other Syncope-side consideration.
Before [1] the logic was not adequate as the internal matching logic [3]
could not be influenced by PullActions.
You have already discovered that SyncDelta instances are immutable; what
you are currently missing is that you can use SyncDeltaBuilder [4] to
generate new SyncDelta instances.
HTH
Regards.
[1] https://issues.apache.org/jira/browse/SYNCOPE-1234
[2]
https://github.com/apache/syncope/blob/2_0_X/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/pushpull/PullActions.java#L40
[3]
https://github.com/apache/syncope/blob/2_0_X/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java#L741
[4]
http://connid.tirasa.net/apidocs/1.4/org/identityconnectors/framework/common/objects/SyncDeltaBuilder.html
On 04/12/2017 16:40, Mikael Ekblom wrote:
Hi,
I have one question: in version 2.0.7 I have noticed that you have
added a preprocess function to the default pull actions class. We
would like to alter the syncdelta in certain cases ie the user should
be kept as enabled (ie. __ENABLED__ set to true) as the user can have
two different roles simultaneously and one primary role should be kept
even though if the user is seen to have lost one primary role in the
case that the user (as an example) has graduated and has been archived
within the study register (__ENABLED__ set to false within the
connector in this case) + we get a match for the user and this
archive. We get a match, but the user should be set to active.
Arcada do not deprovision the users directly either if an entity
matches an archived version for a specific master source.
The user might still have a role as staff or employee and the
syncdelta should be set to __ENABLE__=true in this particular case but
the rest of the roles bound to the student role should be removed.
This could be done in 2.0.6 within the beforeupdate function also,
that in version 2.0.6 returned the SyncDelta but in version 2.0.7 the
same function returns void. How is this supposed to work in the new
implementation in 2.0.7 when you do not have the user information (or
entity together with role information) available directly within the
current function and syncdelta scope within preprocess? The SyncDelta
object just has an read-only map of the current syncdelta attributes
as far as I have seen if you try to alter the attributes within
beforeupdate, so it seems to be too late for that there. You
basically have to look up the user through the __UID__ I guess within
preprocess, but through which function and through which library?
What is the best option you have in this case?
It is enough if you have a hint to give and I’ll find the rest. I hope
this text is somehow understandable!
Regards,
Mikael
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/