Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.kie.remote.services.jms.security;
 
 import java.util.List;
 
 import  org.jbpm.services.task.identity.JAASUserGroupCallbackImpl;
 import  org.jbpm.services.task.identity.adapter.UserGroupAdapter;
 import  org.kie.api.task.TaskService;
This UserGroupAdapter is meant to be stored in the JAASUserGroupCallbackImpl's ThreadLocal field for external UserGroupAdapter implementations. It's necessary because the RequestMessageBean itself must run as a specific or anonymous user (per EJB/MDB specs). In order to make sure that a TaskService command does run with the right user/group info, an instance of this adapter is created with the correct values and injected.
public class JmsUserGroupAdapter implements UserGroupAdapter {
    private final String userId;
    private final List<StringlocalGroups;
    
    public JmsUserGroupAdapter(String userIdString... groups) {
        this. = userId;
        this. = Arrays.asList(groups);
    }
    
    @Override
    public List<StringgetGroupsForUser(String userId) {
        ifthis..equals(userId) ) { 
            return ;
        }
        return .;
    }
New to GrepCode? Check out our FAQ X