Using Candidate Starter Groups for processes

I’m having trouble dynamically specifying a CandidateStarterGroup to a deployed process definition.

I’ve successfully added a candidate starter user and then used a ProcessDefinitionQuery to list all processes startable by that user as follows:

     repositoryService.addCandidateStarterUser("holidayRequest:1:3", "dan");
   List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
		   .deploymentId(deployment.getId())
		   .startableByUser("dan")
		   .list();
  
   for (int i=0; i<processDefinitions.size(); i++) {
	   System.out.println((i+1) + ") " + processDefinitions.get(i).getName());
	 }

Now I’d like to use addCandidateStarterGroup in order to specify a group of users who can start a particular process and issue a similar query. I can’t seem to find the corresponding .startableByGroup("some group") on the ProcessDefinitionQuery object. Are Candidate Starter Groups queried or used differently?

addCandidateStarterGroup(String processDefinitionId, String groupId)
Authorizes a candidate group for a process definition.

The bigger picture here is that I’d like to be able to deploy a process to a downstream environment (i.e. QA, UAT, PROD) and have the ability to configure who can access a process using the groups defined on the target environment.

Thanks,
Dan

Hi Dan,

The support is done by setting the startableByUser property in the process definition query. This will fetch the groups of this user automatically through this code:

By adding your own implementation of the CandidateManager to the process engine configuration you can fetch the groups of the user in your security environment. Then it will also match against the candidate starter groups of the process definition.

Best regards,

Tijs

Thanks for the clarification and the pointer to the code. I was thinking of it afterwards and figured it may be implemented in this way (i.e. driven completely of the user’s identity rather than directly querying for a given group). Good to know how to implement.