Any idea ??
Did I do something wrong there ? De : [email protected] À : [email protected] Sujet : How to remove a group from a user using the Java API Date : 23/10/2020 11:25:19 Europe/Paris 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); } }
