use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class MultiTenancyTaskServiceTest method testGetIdentityLinkWithTenantIdForCandidateUsers.
public void testGetIdentityLinkWithTenantIdForCandidateUsers() {
// given
BpmnModelInstance oneTaskProcess = Bpmn.createExecutableProcess("testProcess").startEvent().userTask("task").camundaCandidateUsers("aUserId").endEvent().done();
deploymentForTenant("tenant", oneTaskProcess);
ProcessInstance tenantProcessInstance = runtimeService.createProcessInstanceByKey("testProcess").processDefinitionTenantId("tenant").execute();
Task tenantTask = taskService.createTaskQuery().processInstanceId(tenantProcessInstance.getId()).singleResult();
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(tenantTask.getId());
assertEquals(identityLinks.size(), 1);
assertEquals(identityLinks.get(0).getTenantId(), "tenant");
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class MultiTenancyTaskServiceTest method testGetIdentityLinkWithTenantIdForCandidateGroup.
public void testGetIdentityLinkWithTenantIdForCandidateGroup() {
// given
BpmnModelInstance oneTaskProcess = Bpmn.createExecutableProcess("testProcess").startEvent().userTask("task").camundaCandidateGroups("aGroupId").endEvent().done();
deploymentForTenant("tenant", oneTaskProcess);
ProcessInstance tenantProcessInstance = runtimeService.createProcessInstanceByKey("testProcess").processDefinitionTenantId("tenant").execute();
Task tenantTask = taskService.createTaskQuery().processInstanceId(tenantProcessInstance.getId()).singleResult();
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(tenantTask.getId());
assertEquals(identityLinks.size(), 1);
assertEquals(identityLinks.get(0).getTenantId(), "tenant");
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testProcessTaskAddCandidateGroupWithTaskAssignPersmissionOnProcessDefinition.
public void testProcessTaskAddCandidateGroupWithTaskAssignPersmissionOnProcessDefinition() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, TASK_ASSIGN);
// when
taskService.addCandidateGroup(taskId, "accounting");
// then
disableAuthorization();
List<IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId);
enableAuthorization();
assertNotNull(linksForTask);
assertEquals(1, linksForTask.size());
IdentityLink identityLink = linksForTask.get(0);
assertNotNull(identityLink);
assertEquals("accounting", identityLink.getGroupId());
assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testProcessTaskAddGroupIdentityLink.
public void testProcessTaskAddGroupIdentityLink() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, taskId, userId, UPDATE);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_TASK);
// when
taskService.addGroupIdentityLink(taskId, "accounting", 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("accounting", identityLink.getGroupId());
assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testProcessTaskAddUserIdentityLinkWithUpdatePersmissionOnAnyTask.
public void testProcessTaskAddUserIdentityLinkWithUpdatePersmissionOnAnyTask() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(TASK, ANY, 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());
}
Aggregations