You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by Alex123 <my...@gmail.com> on 2018/05/23 11:54:35 UTC

How could I share data between PropagationActions and PullActions classes in Syncope?

I have LDAP and REST connectors.

Pull task for LDAP has pull templates for users and groups, both are
connected to REST resource.
REST resource has RestPropagationActions implementation - I use it to add
additional data for users and groups in "before" and "after" methods, such
as "restRemoreId" after user / created successfully.

I am going to use LdapPullActions implementation to attach users and groups
in remote REST resource in "afterAll" method.

- I pull users and groups from LDAP
- then they successfully created (propagated) to remote REST resource 
- then in RestPropagationActions in "after" methods I successfully save
"restRemoreId" attribute for each user and group using userDAO and groupDAO. 
- then I come to the LdapPullActions and in "afterAll" method I try to get
data for newly created users and groups from userDAO and groupDAO and I
don't see "restRemoreId" attribute in models.

Is there a way to share data about users and groups between Propagation
Actions and Pull Actions in Syncope?

--
Sent from: http://syncope-user.1051894.n5.nabble.com/

Re: How could I share data between PropagationActions and PullActions classes in Syncope?

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 23/05/2018 13:54, Alex123 wrote:
> I have LDAP and REST connectors.
>
> Pull task for LDAP has pull templates for users and groups, both are
> connected to REST resource.
> REST resource has RestPropagationActions implementation - I use it to add
> additional data for users and groups in "before" and "after" methods, such
> as "restRemoreId" after user / created successfully.
>
> I am going to use LdapPullActions implementation to attach users and groups
> in remote REST resource in "afterAll" method.
>
> - I pull users and groups from LDAP
> - then they successfully created (propagated) to remote REST resource
> - then in RestPropagationActions in "after" methods I successfully save
> "restRemoreId" attribute for each user and group using userDAO and groupDAO.
> - then I come to the LdapPullActions and in "afterAll" method I try to get
> data for newly created users and groups from userDAO and groupDAO and I
> don't see "restRemoreId" attribute in models.
>
> Is there a way to share data about users and groups between Propagation
> Actions and Pull Actions in Syncope?

Hi,
as you can see from LDAPMembershipPullActions#afterAll [1], you need to 
defer the actual changes to be performed at the end of the current 
transaction; the simplest way to achieve this is through the internal 
schedule() method; you can also look at SetUMembershipsJob [2] as a sample.

HTH
Regards.

[1] 
https://github.com/apache/syncope/blob/2_0_X/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/LDAPMembershipPullActions.java#L178
[2] 
https://github.com/apache/syncope/blob/2_0_X/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SetUMembershipsJob.java

-- 
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/