Hi Francesco,

> Not at all, at least as far as I know :)
> Anyway, I've opened SYNCOPE-91 for taking care of this suggestion of
> yours (and more).

OK great.


> If you take a look at ActivitiUserWorkflowAdapter.delete() (this is
> called by UserController.delete()):
>
>        doExecuteTask(user, "delete", null);
>        userDAO.delete(user);
>
> This means that first the "delete" task is executed (possibly involving
> the Delete class, if workflow XML says so), then user is effectively
> deleted.
> Unfortunately, I don't think that userDAO.delete() can be called by the
> Delete class because it would be in a non-transactional scope; anyway,
> you can give it a try.
I tried that and it runs through the workflow activate -> activateGW
-> delete. I get strange error messages that the object has indeed
been deleted but it's still in the database and visible in console in
the "activate" state. I'll have to look into more detail.

> Alternatively, you can think to put users to be deleted in a "sink"
> status and to create a SchedTask for periodically cleaning up such
> sinked users.
OK maybe I'll try that.

>>> There is also a generic UserController.executeWorkflow() taking UserTO
>>> and task name as parameters for this purpose.
>> Ok this might be handy for my password reset flow. To be sure, an example
>> from the default workflow:
>> when the user is in "active" there are currently three paths. If I would
>> want to push the user to the suspend state I call the executeworkflow with
>> the userTO and "suspend" as taskId?
>
> Correct in principle, but consider that suspend() and reactivate() have
> their own methods. Such methods (alongside with activate()) will take
> care of forwarding the given action to underlying workflow + propagating
> the new user status to associated external resources, if requested /
> necessary.
I was only using them as an example. I was planning to use it for my
password reset functionality which also sends a token and sets a flag
on the user.
The front-end will handle the logic of activating & updating the password

In that case my workflow bit looks like
 <userTask id="active" name="Active"/>

    <sequenceFlow id="flow7" sourceRef="active" targetRef="activeGw"/>

    <exclusiveGateway id="activeGw"/>
    ...
    <sequenceFlow id="active2PasswordReset" sourceRef="activeGw"
targetRef="passwordreset">
      <conditionExpression xsi:type="tFormalExpression">${task ==
'passwordreset'}</conditionExpression>
    </sequenceFlow>
...
    <!-- will generate token and redirect to activate -->
    <serviceTask id="passwordreset" name="Generate token"
activiti:class="org.apache.syncope.core.workflow.activiti.GenerateToken"/>
    <sequenceFlow id="PWRflow1" sourceRef="passwordreset"
targetRef="activatePW"/>
...

So I need to call executeworkflow with the userTO and "passwordreset" as taskId?


The alternative is of course to add the passwordreset method in the
controller and handling in workflow, but that's on the roadmap ;)

best regards

Bob

Reply via email to