use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testProcessTaskAddUserIdentityLinkWithUpdatePersmissionOnTask.
public void testProcessTaskAddUserIdentityLinkWithUpdatePersmissionOnTask() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
// when
taskService.addUserIdentityLink(taskId, "demo", IdentityLinkType.CANDIDATE);
// then
disableAuthorization();
List<IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId);
enableAuthorization();
assertNotNull(linksForTask);
assertEquals(1, linksForTask.size());
IdentityLink identityLink = linksForTask.get(0);
assertNotNull(identityLink);
assertEquals("demo", identityLink.getUserId());
assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterGroups.
@Test
public void shouldPropagateTenantIdToCandidateStarterGroups() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_GROUPS).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(3, links.size());
for (IdentityLink link : links) {
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterUsers.
@Test
public void shouldPropagateTenantIdToCandidateStarterUsers() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_USERS).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(3, links.size());
for (IdentityLink link : links) {
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskServiceTest method testGetIdentityLinksWithCandidateUser.
@Test
public void testGetIdentityLinksWithCandidateUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
identityService.saveUser(identityService.newUser("kermit"));
taskService.addCandidateUser(taskId, "kermit");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(1, identityLinks.size());
assertEquals("kermit", identityLinks.get(0).getUserId());
assertNull(identityLinks.get(0).getGroupId());
assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
// cleanup
taskService.deleteTask(taskId, true);
identityService.deleteUser("kermit");
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskServiceTest method testGetIdentityLinksWithOwner.
@Test
public void testGetIdentityLinksWithOwner() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
identityService.saveUser(identityService.newUser("kermit"));
identityService.saveUser(identityService.newUser("fozzie"));
taskService.claim(taskId, "kermit");
taskService.delegateTask(taskId, "fozzie");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
assertEquals(2, identityLinks.size());
IdentityLink assignee = identityLinks.get(0);
assertEquals("fozzie", assignee.getUserId());
assertNull(assignee.getGroupId());
assertEquals(IdentityLinkType.ASSIGNEE, assignee.getType());
IdentityLink owner = identityLinks.get(1);
assertEquals("kermit", owner.getUserId());
assertNull(owner.getGroupId());
assertEquals(IdentityLinkType.OWNER, owner.getType());
// cleanup
taskService.deleteTask(taskId, true);
identityService.deleteUser("kermit");
identityService.deleteUser("fozzie");
}
Aggregations