use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class FilterAuthorizationsTest method testSaveFilterNotPermitted.
public void testSaveFilterNotPermitted() {
Filter filter = new FilterEntity(EntityTypes.TASK);
try {
filterService.saveFilter(filter);
fail("Exception expected");
} catch (AuthorizationException e) {
// expected
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class FilterAuthorizationsTest method testDeleteFilterNotPermitted.
public void testDeleteFilterNotPermitted() {
Filter filter = createTestFilter();
try {
filterService.deleteFilter(filter.getId());
fail("Exception expected");
} catch (AuthorizationException e) {
// expected
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testSaveTaskInsertWithoutAuthorization.
// save task (insert) //////////////////////////////////////////////////////////
public void testSaveTaskInsertWithoutAuthorization() {
// given
TaskEntity task = TaskEntity.create();
try {
// when
taskService.saveTask(task);
fail("Exception expected: It should not be possible to save a task.");
} catch (AuthorizationException e) {
// then
assertTextPresent("The user with id 'test' does not have 'CREATE' permission on resource 'Task'", e.getMessage());
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceAuthorizationTest method testDeleteHistoricDecisionInstanceByInstanceIdWithoutAuthorization.
public void testDeleteHistoricDecisionInstanceByInstanceIdWithoutAuthorization() {
// given
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ_HISTORY);
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
HistoricDecisionInstance historicDecisionInstance = query.includeInputs().includeOutputs().singleResult();
try {
// when
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
fail("expect authorization exception");
} catch (AuthorizationException e) {
// then
assertThat(e.getMessage(), is("The user with id 'test' does not have 'DELETE_HISTORY' permission on resource 'testDecision' of type 'DecisionDefinition'."));
}
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testReportWithQueryCriterionProcessDefinitionKeyInAndMissingReadHistoryPermission.
public void testReportWithQueryCriterionProcessDefinitionKeyInAndMissingReadHistoryPermission() {
// 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, MESSAGE_START_PROCESS_KEY).duration(PeriodUnit.MONTH);
// then
fail("Exception expected: It should not be possible to create a historic process instance report");
} catch (AuthorizationException e) {
}
}
Aggregations