use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogRestServiceImpl method getHistoricIdentityLinksCount.
@Override
public CountResultDto getHistoricIdentityLinksCount(UriInfo uriInfo) {
HistoricIdentityLinkLogQueryDto queryDto = new HistoricIdentityLinkLogQueryDto(objectMapper, uriInfo.getQueryParameters());
HistoricIdentityLinkLogQuery query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogAuthorizationTest method testQueryForTaskHistoricIdentityLinkWithoutUserPermission.
public void testQueryForTaskHistoricIdentityLinkWithoutUserPermission() {
// given
disableAuthorization();
startProcessInstanceByKey(ONE_PROCESS_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
// if
identityService.setAuthenticatedUserId("aAssignerId");
taskService.addCandidateUser(taskId, "aUserId");
enableAuthorization();
// when
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogAuthorizationTest method testMixedQuery.
public void testMixedQuery() {
disableAuthorization();
// given
startProcessInstanceByKey(ONE_PROCESS_KEY);
startProcessInstanceByKey(ONE_PROCESS_KEY);
startProcessInstanceByKey(ONE_PROCESS_KEY);
createCaseInstanceByKey(CASE_KEY);
taskService.addCandidateUser(taskService.createTaskQuery().list().get(3).getId(), "dUserId");
createCaseInstanceByKey(CASE_KEY);
taskService.addCandidateUser(taskService.createTaskQuery().list().get(4).getId(), "eUserId");
createTaskAndAssignUser("one");
createTaskAndAssignUser("two");
createTaskAndAssignUser("three");
createTaskAndAssignUser("four");
createTaskAndAssignUser("five");
enableAuthorization();
// when
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 7);
disableAuthorization();
query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 10);
// if
createGrantAuthorization(PROCESS_DEFINITION, ONE_PROCESS_KEY, userId, READ_HISTORY);
enableAuthorization();
query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 10);
deleteTask("one", true);
deleteTask("two", true);
deleteTask("three", true);
deleteTask("four", true);
deleteTask("five", true);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogAuthorizationTest method testQueryWithMultiple.
public void testQueryWithMultiple() {
// given
disableAuthorization();
startProcessInstanceByKey(ONE_PROCESS_KEY);
// if
createGrantAuthorization(PROCESS_DEFINITION, ONE_PROCESS_KEY, userId, READ_HISTORY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
enableAuthorization();
// when
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method historicIdentityLinkForMultipleTenant.
@Test
public void historicIdentityLinkForMultipleTenant() {
startProcessInstanceForTenant(TENANT_1);
// Query test
HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
assertEquals(historicIdentityLink.getTenantId(), TENANT_1);
// start process instance for another tenant
startProcessInstanceForTenant(TENANT_2);
// Query test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_2).count(), 1);
}
Aggregations