Re: empty statuses in LogicActions.afterUpdate
Hi Francesco, Your answer is absolutely clear, thanks Regards Lionel - Le 25 Oct 23, à 16:28, Francesco Chicchiriccò ilgro...@apache.org a écrit : > So let me summarize what is happening. > > This step: > > - update the user so that the approval is needed > > is actually performed by calling > > PATCH /users/self/ > > or > > PATCH /users/ > > depending on whether the caller is the user themselveers or an administrator. > Both invocations reach up to UserLogic#doUpdate that is where any matching > LogicActions#afterUpdate is invoked. > > If the update as above is triggering an approval in the defined user workflow, > any propagation is suspended. > > This step: > > - approve the update > > (I assume performed via Console) is instead calling > > POST /flowable/userRequests/forms/ > > As you can see from Swagger UI, this all is returning all the propagation > statuses as expected. > > Hence, if you want to decorate the result of a form approval - similarly to > what > you are doing via LogicActions#afterUpdate for plain updates - you will have > to > code this into a workflow task, to be inserted in your definition right after > approval. > > Hope this clarifies. > Regards. > > On 24/10/23 09:48, Lionel SCHWARZ wrote: >> Hi Francesco, >> Thanks for your answer. >> >> You should be able to reproduce this with the UserWorkflow defined in the fit >> part of Syncope (which I used as a base for my customized workflow >> definition) >> and with the LogicActions implementation attached to the email: >> >> - declare the ExampleLogicAction in the default realm >> - create a user in the default realm with a resource >> - update the user so that the approval is needed >> - approve the update >> - check in the log that the afterUdate() receives empty >> List >> >> AND >> - update the user so that the approval is NOT needed >> - check in the log that the afterUdate() receives List >> with 1 >> item: the propagation of the resource >> >> >> Best regards >> Lionel >> >> - Le 24 Oct 23, à 8:44, Francesco Chicchiriccò ilgro...@apache.org a >> écrit : >> >>> Hi Lionel, >>> can you provide a simple project that reproduces this issue? >>> >>> It should be enough to create a new Maven project from latest stable version >>> (3.0.5 at this time), change the workflow definition to match your case and >>> finally provide the steps to reproduce in embedded mode. >>> >>> Regards. >>> >>> On 23/10/23 18:10, Lionel SCHWARZ wrote: To be more specific about the issue, I must tell that I have a flowable UserWorkflow with approval on user update operations (on certain circumstances). It seems that when the update needs approval, the afterUpdate() is called before approval with an empty List. When the update does not need approval, the afterUpdate() works fine. Lionel - Le 23 Oct 23, à 17:36, Lionel SCHWARZ lionel.schw...@in2p3.fr a écrit : > Dear all, > > I have a customized LogicAction with afterUpdate() implementation, but > this > method receives an empty List when called. > Nevertheless, the propagation works fine, and I get the correct REST > response > with propagationStatuses and beforeObg/afterObj. > > Am I missing something? > > Regards > Lionel > > -- > 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/ smime.p7s Description: S/MIME Cryptographic Signature
Re: empty statuses in LogicActions.afterUpdate
So let me summarize what is happening. This step: - update the user so that the approval is needed is actually performed by calling PATCH /users/self/ or PATCH /users/ depending on whether the caller is the user themselveers or an administrator. Both invocations reach up to UserLogic#doUpdate that is where any matching LogicActions#afterUpdate is invoked. If the update as above is triggering an approval in the defined user workflow, any propagation is suspended. This step: - approve the update (I assume performed via Console) is instead calling POST /flowable/userRequests/forms/ As you can see from Swagger UI, this all is returning all the propagation statuses as expected. Hence, if you want to decorate the result of a form approval - similarly to what you are doing via LogicActions#afterUpdate for plain updates - you will have to code this into a workflow task, to be inserted in your definition right after approval. Hope this clarifies. Regards. On 24/10/23 09:48, Lionel SCHWARZ wrote: Hi Francesco, Thanks for your answer. You should be able to reproduce this with the UserWorkflow defined in the fit part of Syncope (which I used as a base for my customized workflow definition) and with the LogicActions implementation attached to the email: - declare the ExampleLogicAction in the default realm - create a user in the default realm with a resource - update the user so that the approval is needed - approve the update - check in the log that the afterUdate() receives empty List AND - update the user so that the approval is NOT needed - check in the log that the afterUdate() receives List with 1 item: the propagation of the resource Best regards Lionel - Le 24 Oct 23, à 8:44, Francesco Chicchiriccò ilgro...@apache.org a écrit : Hi Lionel, can you provide a simple project that reproduces this issue? It should be enough to create a new Maven project from latest stable version (3.0.5 at this time), change the workflow definition to match your case and finally provide the steps to reproduce in embedded mode. Regards. On 23/10/23 18:10, Lionel SCHWARZ wrote: To be more specific about the issue, I must tell that I have a flowable UserWorkflow with approval on user update operations (on certain circumstances). It seems that when the update needs approval, the afterUpdate() is called before approval with an empty List. When the update does not need approval, the afterUpdate() works fine. Lionel - Le 23 Oct 23, à 17:36, Lionel SCHWARZ lionel.schw...@in2p3.fr a écrit : Dear all, I have a customized LogicAction with afterUpdate() implementation, but this method receives an empty List when called. Nevertheless, the propagation works fine, and I get the correct REST response with propagationStatuses and beforeObg/afterObj. Am I missing something? Regards Lionel -- 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/
Re: empty statuses in LogicActions.afterUpdate
Hi Francesco, Thanks for your answer. You should be able to reproduce this with the UserWorkflow defined in the fit part of Syncope (which I used as a base for my customized workflow definition) and with the LogicActions implementation attached to the email: - declare the ExampleLogicAction in the default realm - create a user in the default realm with a resource - update the user so that the approval is needed - approve the update - check in the log that the afterUdate() receives empty List AND - update the user so that the approval is NOT needed - check in the log that the afterUdate() receives List with 1 item: the propagation of the resource Best regards Lionel - Le 24 Oct 23, à 8:44, Francesco Chicchiriccò ilgro...@apache.org a écrit : > Hi Lionel, > can you provide a simple project that reproduces this issue? > > It should be enough to create a new Maven project from latest stable version > (3.0.5 at this time), change the workflow definition to match your case and > finally provide the steps to reproduce in embedded mode. > > Regards. > > On 23/10/23 18:10, Lionel SCHWARZ wrote: >> To be more specific about the issue, I must tell that I have a flowable >> UserWorkflow with approval on user update operations (on certain >> circumstances). >> It seems that when the update needs approval, the afterUpdate() is called >> before >> approval with an empty List. >> When the update does not need approval, the afterUpdate() works fine. >> >> Lionel >> >> - Le 23 Oct 23, à 17:36, Lionel SCHWARZ lionel.schw...@in2p3.fr a écrit : >> >>> Dear all, >>> >>> I have a customized LogicAction with afterUpdate() implementation, but this >>> method receives an empty List when called. >>> Nevertheless, the propagation works fine, and I get the correct REST >>> response >>> with propagationStatuses and beforeObg/afterObj. >>> >>> Am I missing something? >>> >>> Regards >>> Lionel > > -- > 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/ package org.apache.syncope.core.logic.api; import java.util.List; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.PropagationStatus; import org.apache.syncope.common.lib.to.UserTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ExampleLogicActions implements LogicActions { protected static final Logger LOG = LoggerFactory.getLogger(ExampleLogicActions.class); public ExampleLogicActions() { } @Override public A afterUpdate(A input, List statuses) { if (input instanceof UserTO) { LOG.warn("afterUpdate, size of List is {}", statuses.size()); } return input; } } smime.p7s Description: S/MIME Cryptographic Signature
Re: empty statuses in LogicActions.afterUpdate
Hi Lionel, can you provide a simple project that reproduces this issue? It should be enough to create a new Maven project from latest stable version (3.0.5 at this time), change the workflow definition to match your case and finally provide the steps to reproduce in embedded mode. Regards. On 23/10/23 18:10, Lionel SCHWARZ wrote: To be more specific about the issue, I must tell that I have a flowable UserWorkflow with approval on user update operations (on certain circumstances). It seems that when the update needs approval, the afterUpdate() is called before approval with an empty List. When the update does not need approval, the afterUpdate() works fine. Lionel - Le 23 Oct 23, à 17:36, Lionel SCHWARZ lionel.schw...@in2p3.fr a écrit : Dear all, I have a customized LogicAction with afterUpdate() implementation, but this method receives an empty List when called. Nevertheless, the propagation works fine, and I get the correct REST response with propagationStatuses and beforeObg/afterObj. Am I missing something? Regards Lionel -- 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/
Re: empty statuses in LogicActions.afterUpdate
To be more specific about the issue, I must tell that I have a flowable UserWorkflow with approval on user update operations (on certain circumstances). It seems that when the update needs approval, the afterUpdate() is called before approval with an empty List. When the update does not need approval, the afterUpdate() works fine. Lionel - Le 23 Oct 23, à 17:36, Lionel SCHWARZ lionel.schw...@in2p3.fr a écrit : > Dear all, > > I have a customized LogicAction with afterUpdate() implementation, but this > method receives an empty List when called. > Nevertheless, the propagation works fine, and I get the correct REST response > with propagationStatuses and beforeObg/afterObj. > > Am I missing something? > > Regards > Lionel smime.p7s Description: S/MIME Cryptographic Signature