you need to add the user to takservice by using the following code
|
|
| Properties userGroups = new Properties(); |
|
|
| userGroups.setProperty("john", "user"); |
|
|
| UserGroupCallbackManager manager = UserGroupCallbackManager.getInstance(); |
|
|
| manager.setCallback(new DefaultUserGroupCallbackImpl(userGroups)); |
or implement a an UserGroupCallback. Then
UserGroupCallbackManager manager = UserGroupCallbackManager
.getInstance();
if (!manager.existsCallback()) {
UserGroupCallback userGroupCallback = new JBPMUserGroupCallback();
manager.setCallback(userGroupCallback);
}
this is the callback implementation:
public class JBPMUserGroupCallback implements UserGroupCallback {
@Override
public boolean existsGroup(String groupId) {
return true;
}
@Override
public boolean existsUser(String userId) {
return true;
}
@Override
public List<String> getGroupsForUser(String userId, List<String> groupIds,
List<String> allExistingGroupIds) {
if(groupIds != null) {
List<String> retList = new ArrayList<String>(groupIds);
// merge all groups
if(allExistingGroupIds != null) {
for(String grp : allExistingGroupIds) {
if(!retList.contains(grp)) {
retList.add(grp);
}
}
}
return retList;
} else {
//
// return empty list by default
//please note: there are different return value for different version of jPBM
//List<String> retList = new ArrayList<String>();
//retList.add("user");
//return retList;
//return new ArrayList<String>(); //for jBPM5.3.0.Final
return null; //for jBPM5.4.0.CR1
}
}
}