Search in sources :

Example 26 with IdentityLink

use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.

the class TaskAuthorizationTest method testStandaloneTaskAddCandidateUser.

public void testStandaloneTaskAddCandidateUser() {
    // given
    String taskId = "myTask";
    createTask(taskId);
    createGrantAuthorization(TASK, taskId, userId, UPDATE);
    // when
    taskService.addCandidateUser(taskId, "demo");
    // 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());
    deleteTask(taskId, true);
}
Also used : IdentityLink(org.camunda.bpm.engine.task.IdentityLink)

Example 27 with IdentityLink

use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.

the class TaskAuthorizationTest method testProcessTaskAddCandidateUserWithTaskAssignPermissionOnTask.

public void testProcessTaskAddCandidateUserWithTaskAssignPermissionOnTask() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    createGrantAuthorization(TASK, taskId, userId, TASK_ASSIGN);
    // when
    taskService.addCandidateUser(taskId, "demo");
    // 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());
}
Also used : IdentityLink(org.camunda.bpm.engine.task.IdentityLink)

Example 28 with IdentityLink

use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.

the class TaskAuthorizationTest method testStandaloneTaskAddGroupIdentityLink.

public void testStandaloneTaskAddGroupIdentityLink() {
    // given
    String taskId = "myTask";
    createTask(taskId);
    createGrantAuthorization(TASK, taskId, userId, UPDATE);
    // 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());
    deleteTask(taskId, true);
}
Also used : IdentityLink(org.camunda.bpm.engine.task.IdentityLink)

Example 29 with IdentityLink

use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.

the class TaskAuthorizationTest method testProcessTaskAddCandidateGroupWithUpdatePersmissionOnAnyTask.

public void testProcessTaskAddCandidateGroupWithUpdatePersmissionOnAnyTask() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    createGrantAuthorization(TASK, ANY, userId, UPDATE);
    // 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());
}
Also used : IdentityLink(org.camunda.bpm.engine.task.IdentityLink)

Example 30 with IdentityLink

use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.

the class TaskAuthorizationTest method testProcessTaskAddCandidateGroupWithTaskAssignPermission.

public void testProcessTaskAddCandidateGroupWithTaskAssignPermission() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    String taskId = selectSingleTask().getId();
    createGrantAuthorization(TASK, taskId, userId, TASK_ASSIGN);
    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());
}
Also used : IdentityLink(org.camunda.bpm.engine.task.IdentityLink)

Aggregations

IdentityLink (org.camunda.bpm.engine.task.IdentityLink)81 Task (org.camunda.bpm.engine.task.Task)13 Deployment (org.camunda.bpm.engine.test.Deployment)13 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)12 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 InputStream (java.io.InputStream)4 HashSet (java.util.HashSet)4 Expression (org.camunda.bpm.engine.delegate.Expression)4 HistoricIdentityLinkLog (org.camunda.bpm.engine.history.HistoricIdentityLinkLog)4 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)4 VariableMap (org.camunda.bpm.engine.variable.VariableMap)4 TaskService (org.camunda.bpm.engine.TaskService)3 HistoricIdentityLinkLogQuery (org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)3 List (java.util.List)2 HalResource (org.camunda.bpm.engine.rest.hal.HalResource)2 Job (org.camunda.bpm.engine.runtime.Job)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 Matchers.anyString (org.mockito.Matchers.anyString)2