Search in sources :

Example 6 with RuntimeServiceImpl

use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.

the class ProcessInstanceAuthorizationTest method testUpdateVariablesLocalWithReadPermissionOnProcessInstance.

public void testUpdateVariablesLocalWithReadPermissionOnProcessInstance() {
    // given
    String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    // when (1)
    ((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, getVariables(), null);
    // then (1)
    disableAuthorization();
    verifyQueryResults(query, 1);
    enableAuthorization();
    // when (2)
    ((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, null, Arrays.asList(VARIABLE_NAME));
    // then (2)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
    // when (3)
    ((RuntimeServiceImpl) runtimeService).updateVariablesLocal(processInstanceId, getVariables(), Arrays.asList(VARIABLE_NAME));
    // then (3)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) RuntimeServiceImpl(org.camunda.bpm.engine.impl.RuntimeServiceImpl)

Example 7 with RuntimeServiceImpl

use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.

the class ProcessInstanceAuthorizationTest method testUpdateVariablesWithReadPermissionOnProcessInstance.

public void testUpdateVariablesWithReadPermissionOnProcessInstance() {
    // given
    String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    // when (1)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), null);
    // then (1)
    disableAuthorization();
    verifyQueryResults(query, 1);
    enableAuthorization();
    // when (2)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, null, Arrays.asList(VARIABLE_NAME));
    // then (2)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
    // when (3)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), Arrays.asList(VARIABLE_NAME));
    // then (3)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) RuntimeServiceImpl(org.camunda.bpm.engine.impl.RuntimeServiceImpl)

Example 8 with RuntimeServiceImpl

use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.

the class ProcessInstanceAuthorizationTest method testUpdateVariablesWithReadPermissionOnAnyProcessInstance.

public void testUpdateVariablesWithReadPermissionOnAnyProcessInstance() {
    // given
    String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    // when (1)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), null);
    // then (1)
    disableAuthorization();
    verifyQueryResults(query, 1);
    enableAuthorization();
    // when (2)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, null, Arrays.asList(VARIABLE_NAME));
    // then (2)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
    // when (3)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), Arrays.asList(VARIABLE_NAME));
    // then (3)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) RuntimeServiceImpl(org.camunda.bpm.engine.impl.RuntimeServiceImpl)

Example 9 with RuntimeServiceImpl

use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.

the class ExecutionVariablesResource method updateVariableEntities.

protected void updateVariableEntities(VariableMap modifications, List<String> deletions) {
    RuntimeServiceImpl runtimeService = (RuntimeServiceImpl) engine.getRuntimeService();
    runtimeService.updateVariables(resourceId, modifications, deletions);
}
Also used : RuntimeServiceImpl(org.camunda.bpm.engine.impl.RuntimeServiceImpl)

Example 10 with RuntimeServiceImpl

use of org.camunda.bpm.engine.impl.RuntimeServiceImpl in project camunda-bpm-platform by camunda.

the class ProcessInstanceAuthorizationTest method testUpdateVariablesWithReadInstancePermissionOnProcessDefinition.

public void testUpdateVariablesWithReadInstancePermissionOnProcessDefinition() {
    // given
    String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_INSTANCE);
    VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
    // when (1)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), null);
    // then (1)
    disableAuthorization();
    verifyQueryResults(query, 1);
    enableAuthorization();
    // when (2)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, null, Arrays.asList(VARIABLE_NAME));
    // then (2)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
    // when (3)
    ((RuntimeServiceImpl) runtimeService).updateVariables(processInstanceId, getVariables(), Arrays.asList(VARIABLE_NAME));
    // then (3)
    disableAuthorization();
    verifyQueryResults(query, 0);
    enableAuthorization();
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) RuntimeServiceImpl(org.camunda.bpm.engine.impl.RuntimeServiceImpl)

Aggregations

RuntimeServiceImpl (org.camunda.bpm.engine.impl.RuntimeServiceImpl)12 VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)8 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Test (org.junit.Test)2 Task (org.camunda.bpm.engine.task.Task)1