use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testReportWithoutQueryCriteriaAndNoReadHistoryPermission.
public void testReportWithoutQueryCriteriaAndNoReadHistoryPermission() {
// given
ProcessInstance processInstance1 = startProcessInstanceByKey(PROCESS_KEY);
ProcessInstance processInstance2 = startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
disableAuthorization();
runtimeService.deleteProcessInstance(processInstance1.getProcessInstanceId(), "");
runtimeService.deleteProcessInstance(processInstance2.getProcessInstanceId(), "");
enableAuthorization();
// when
try {
historyService.createHistoricProcessInstanceReport().duration(PeriodUnit.MONTH);
// then
fail("Exception expected: It should not be possible to create a historic process instance report");
} catch (AuthorizationException e) {
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testReportWithMixedQueryCriteriaAndMissingReadHistoryPermission.
public void testReportWithMixedQueryCriteriaAndMissingReadHistoryPermission() {
// given
ProcessInstance processInstance1 = startProcessInstanceByKey(PROCESS_KEY);
ProcessInstance processInstance2 = startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
disableAuthorization();
runtimeService.deleteProcessInstance(processInstance1.getProcessInstanceId(), "");
runtimeService.deleteProcessInstance(processInstance2.getProcessInstanceId(), "");
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
try {
historyService.createHistoricProcessInstanceReport().processDefinitionKeyIn(PROCESS_KEY).processDefinitionIdIn(processInstance2.getProcessDefinitionId()).duration(PeriodUnit.MONTH);
// then
fail("Exception expected: It should not be possible to create a historic process instance report");
} catch (AuthorizationException e) {
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testReportWithQueryCriterionProcessDefinitionIdInAndMissingReadHistoryPermission.
public void testReportWithQueryCriterionProcessDefinitionIdInAndMissingReadHistoryPermission() {
// given
ProcessInstance processInstance1 = startProcessInstanceByKey(PROCESS_KEY);
ProcessInstance processInstance2 = startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
disableAuthorization();
runtimeService.deleteProcessInstance(processInstance1.getProcessInstanceId(), "");
runtimeService.deleteProcessInstance(processInstance2.getProcessInstanceId(), "");
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
try {
historyService.createHistoricProcessInstanceReport().processDefinitionIdIn(processInstance1.getProcessDefinitionId(), processInstance2.getProcessDefinitionId()).duration(PeriodUnit.MONTH);
// then
fail("Exception expected: It should not be possible to create a historic process instance report");
} catch (AuthorizationException e) {
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance.
public void testActivateProcessInstanceByProcessDefinitionIdWithUpdatePermissionOnProcessInstance() {
// given
ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
String processInstanceId = instance.getId();
String processDefinitionId = instance.getProcessDefinitionId();
suspendProcessInstanceById(processInstanceId);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
try {
// when
runtimeService.activateProcessInstanceByProcessDefinitionId(processDefinitionId);
fail("Exception expected: It should not be posssible to suspend a process instance.");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent(userId, message);
assertTextPresent(UPDATE_INSTANCE.getName(), message);
assertTextPresent(PROCESS_KEY, message);
assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class ProcessInstanceAuthorizationTest method testActivateProcessInstanceByProcessDefinitionKeyWithoutAuthorization.
// activate process instance by process definition key /////////////////////////////
public void testActivateProcessInstanceByProcessDefinitionKeyWithoutAuthorization() {
// given
ProcessInstance instance = startProcessInstanceByKey(PROCESS_KEY);
String processInstanceId = instance.getId();
suspendProcessInstanceById(processInstanceId);
try {
// when
runtimeService.activateProcessInstanceByProcessDefinitionKey(PROCESS_KEY);
fail("Exception expected: It should not be posssible to suspend a process instance.");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent(userId, message);
assertTextPresent(UPDATE_INSTANCE.getName(), message);
assertTextPresent(PROCESS_KEY, message);
assertTextPresent(PROCESS_DEFINITION.resourceName(), message);
}
}
Aggregations