You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by Sarris Overbosch | Everett <sa...@everett.nl> on 2012/07/27 14:59:13 UTC

Suggestions Needed...

Hi All,

I'm currently in the process of migrating to Syncope 0.7.1 (still not
1.0 because it has not yet been released :'() and during this migration
I stumbled up on a problem. This problem has to do with the moment a
newly created user is saved to the database, the part of the workflow
which is for creation of the user has the syncope user object without an
(database) id (After the create part of the workflow is finished the
user is saved and then it has the id). For some hashing we rely on the
database id of the syncope user but because this is not available at the
moment of creation this hash method fails. Now I have one solution which
consists of creating the user without the values to hash and then update
the user with the values to hash (the update part of the workflow should
do the hashing without a problem because the database id is present).
But to be honest I am not happy with that solution, I was looking for
some post creation event or similar but could not find it. So my
question to you all is, do you see any other solution for this problem?

Br,

Sarris


Re: Suggestions Needed...

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 27/07/2012 14:59, Sarris Overbosch | Everett wrote:
> Hi All,
>
> I'm currently in the process of migrating to Syncope 0.7.1 (still not
> 1.0 because it has not yet been released :'() and during this migration
> I stumbled up on a problem. This problem has to do with the moment a
> newly created user is saved to the database, the part of the workflow
> which is for creation of the user has the syncope user object without an
> (database) id (After the create part of the workflow is finished the
> user is saved and then it has the id). For some hashing we rely on the
> database id of the syncope user but because this is not available at the
> moment of creation this hash method fails. Now I have one solution which
> consists of creating the user without the values to hash and then update
> the user with the values to hash (the update part of the workflow should
> do the hashing without a problem because the database id is present).
> But to be honest I am not happy with that solution, I was looking for
> some post creation event or similar but could not find it. So my
> question to you all is, do you see any other solution for this problem?

Hi Sarris,
by taking a quick look at ActivitiUserWorkflowAdapter [1], there seems 
to be currently no option to have, in the create workflow, a SyncopeUser 
object with generated id, since the merge - which auto-generates the id 
- only takes places *after* workflow steps execution.

However, you could just extend [1] and override the create() method in 
order to place your own logic (hashing) right after the line

user = userDAO.save(user);

Alternatively, you can make new users subject to approval and perform 
the hashing on the approval steps of the worklfow; of course you should 
also set up things to make automatic approval.

Regards.

[1] 
https://svn.apache.org/repos/asf/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java

-- 
Francesco Chicchiriccò

ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/