cancel
Showing results for 
Search instead for 
Did you mean: 

Custom identity management changed in Activiti 6.0

abandarupalli
Champ in-the-making
Champ in-the-making

I am trying to use custom identity management with Activiti 6.0

The example i user guide is not matching with the one in Activiti 6.0

public class MyGroupManagerFactory implements SessionFactory {

@Override

public Class<?> getSessionType() {

    return GroupIdentityManager.class;

}

@Override

public Session openSession() {

return new MyCompanyGroupManager();

}

}

public class UserManagerFactory implements SessionFactory{
    @Override
    public Class<?> getSessionType() {
    }

    @Override
    public Session openSession(CommandContext commandContext) {
    }
}

The CommandContext seems to be the parameter for openSession(). Anybody dealt with the discrepancy and got it working..?

3 REPLIES 3

daisuke-yoshimo
Star Collaborator
Star Collaborator

Probably, I think that you can use custom identity management with Activiti 6.0 with the following procedure.

1. Implement the GroupDataManager interface. Or, extend MybatisGroupDataManager.class

2. ProcessEngineConfigurationImpl.setGroupDataManager(GroupDataManager groupDataManager)

Activiti/ProcessEngineConfigurationImpl.java at 6.x · Activiti/Activiti · GitHub 

Certainly, Activiti user guide is wrong.

Activiti User Guide 

Reference

https://community.alfresco.com/community/bpm/blog/2017/06/01/activiti-6-is-here 

I am having the same issue.  Does this work?  Does the SessionFactory interface no longer need to be implemented?  And what about groupEntityManager?

When I try this, when claiming or unclaiming a task, the AbstractEntityManager.findById method is called, not my implemented findById method.  My method is overriding this one, so it should be called?

My code is like this:

public class SpringSecurityUserManager extends UserEntityManagerImpl {

    private static final Logger logger = LoggerFactory.getLogger(SpringSecurityUserManager.class);

    @Autowired
    AuthUserService authUserService;

    @Autowired
    public SpringSecurityUserManager(ProcessEngineConfigurationImpl processEngineConfiguration, UserDataManager userDataManager,
                                     AuthUserService authUserService) {
        super(processEngineConfiguration, userDataManager);
        this.authUserService = authUserService;
    }

    @Override
    public UserEntity findById(String userId) {
        logger.info("findById for userId:{} ", userId);
        UserEntityImpl user = new UserEntityImpl();
        user.setId(authUserService.getCurrentUserName());
        return user;
    }

Thanks

nortobc
Champ in-the-making
Champ in-the-making

Can somebody please look at this?  I am having issues with custom identity management on Activiti 6.0.  From the above code, I tried to extend MybatisGroupDataManager instead of GroupEntityManagerImpl and that didn't work.  I also tried to implement GroupDataManager and that didn't work either.  (also tried with MybatisUserDataManager and UserEntityManagerImpl) When I debug, the breakpoint keeps stopping inside AbstractDataManager.findById instead of SpringSecurityUserManager.findById.

I am also setting appropriate SpringProcessEngineConfiguration, I believe.