JBoss Community

Re: Defining users for TaskServer - jbpm5

created by Alex Pavlov in jBPM - View the full discussion

Cristiano Nicolai wrote:

 

I'm wondering if there is a better way to deal with users and groups. My point is, and probably is a very common use case, to have users and groups in a external source, like DB or LDAP, forcing a replication of this data to TaskServer DB.

 

Any thought?

 

Mauricio Salatino wrote:

 

Yes of course, that's why all the classes inside: https://github.com/krisv/jbpm/tree/master/jbpm-human-task/src/main/java/org/jbpm/userprofile

exist. They abstract the model of users and these classes can be extended to wrap your user/group models. Please take a look at the comments in the classes, those probably are the answer to your question.

Greetings!

 

Mauricio, could you please elaborate a bit further? I do not see the UserProfileManager class (the one, the custom implementation of UserProfileRepository interface is supposed to be plugged in) to be used at all. Furthermore, the org.jbpm.task.User object is hardcoded to be an entity in a local database and since Task entity has a reference to the User object, the very moment TaskServiceSession.addTask() tries to persist the Task object for user, which is not in the local database, exception inevitably fires:

 

java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`taskserver`.`task`, CONSTRAINT `FK27A9A59E619A0` FOREIGN KEY (`createdBy_id`) REFERENCES `organizationalentity` (`id`))

 

The bottom line: all users must be replicated in the task server database. Definitely not the way to go, and this is probably why all the classes in the org.jbpm.userprofile exist. But I do not see how one could make any use of the org.jbpm.userprofile package at all.

 

So, could you please describe, what is the recommended way to integrate the task server with an external user repository?

 

Thank you,

Alex

Reply to this message by going to Community

Start a new discussion in jBPM at Community