Hi all,

I try to implement in the user lifecycle a check about its groups between state 
'create' and 'activate'.

In the Flowable process definition, I added a service task implemented as a 
Java Delegate class as following ("currentProfile" is one of the user groups 
set on creation).

After the execution of this service task, all groups seems to be always 
associated to the user. 



Can you help me ? Am I using a wrong API ?

Thanks for your help !

Christophe



@Component
public class RemoveProfile extends FlowableServiceTask {

    @Autowired
    private UserDataBinder dataBinder;

    @Override
    protected void doExecute(final DelegateExecution execution) {
        
        MembershipTO currentProfile = execution.getVariable("currentProfile", 
MembershipTO.class);
        System.out.println("Profile courant à retirer: " + currentProfile);

        User user = execution.getVariable(FlowableRuntimeUtils.USER, 
User.class);
        
        UserPatch userPatch = new UserPatch();
        MembershipPatch membershipPatch = new MembershipPatch();
        membershipPatch.setGroup(currentProfile.getGroupName());
        membershipPatch.setOperation(PatchOperation.DELETE);
        userPatch.getMemberships().add(membershipPatch);
        
        dataBinder.update(user, userPatch);

    }
}


Reply via email to