use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionQueryTest method queryByLatestWithoutTenantId.
@Test
public void queryByLatestWithoutTenantId() {
// deploy a second version without tenant id
testRule.deploy(DMN);
DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion().withoutTenantId();
assertThat(query.count(), is(1L));
DecisionRequirementsDefinition DecisionRequirementsDefinition = query.singleResult();
assertThat(DecisionRequirementsDefinition.getTenantId(), is(nullValue()));
assertThat(DecisionRequirementsDefinition.getVersion(), is(2));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionQueryTest method queryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId.
@Test
public void queryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId() {
// deploy a second version without tenant id
testRule.deploy(DMN);
// deploy a third version for tenant one
testRule.deployForTenant(TENANT_ONE, DMN);
testRule.deployForTenant(TENANT_ONE, DMN);
DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DECISION_REQUIREMENTS_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE, TENANT_TWO).includeDecisionRequirementsDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
Map<String, DecisionRequirementsDefinition> definitionsForTenant = getDecisionRequirementsDefinitionsForTenant(query.list());
assertThat(definitionsForTenant.get(TENANT_ONE).getVersion(), is(3));
assertThat(definitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
assertThat(definitionsForTenant.get(null).getVersion(), is(2));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionRequirementsDefinitionCmdsTenantCheckTest method getDecisionRequirementsDefinitionDisabledTenantCheck.
@Test
public void getDecisionRequirementsDefinitionDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
DecisionRequirementsDefinition definition = repositoryService.getDecisionRequirementsDefinition(decisionRequirementsDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class StatisticsManager method checkReadDecisionRequirementsDefinition.
protected void checkReadDecisionRequirementsDefinition(HistoricDecisionInstanceStatisticsQueryImpl query) {
CommandContext commandContext = getCommandContext();
if (isAuthorizationEnabled() && getCurrentAuthentication() != null && commandContext.isAuthorizationCheckEnabled()) {
String decisionRequirementsDefinitionId = query.getDecisionRequirementsDefinitionId();
DecisionRequirementsDefinition definition = getDecisionRequirementsDefinitionManager().findDecisionRequirementsDefinitionById(decisionRequirementsDefinitionId);
ensureNotNull("no deployed decision requirements definition found with id '" + decisionRequirementsDefinitionId + "'", "decisionRequirementsDefinition", definition);
getAuthorizationManager().checkAuthorization(READ, DECISION_REQUIREMENTS_DEFINITION, definition.getKey());
}
}
use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition in project camunda-bpm-platform by camunda.
the class DecisionRequirementsDefinitionAuthorizationTest method getDecisionRequirementsDefinition.
@Test
@Deployment(resources = { DMN_FILE })
public void getDecisionRequirementsDefinition() {
String decisionRequirementsDefinitionId = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(DEFINITION_KEY).singleResult().getId();
// when
authRule.init(scenario).withUser("userId").bindResource("decisionRequirementsDefinitionKey", DEFINITION_KEY).start();
DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.getDecisionRequirementsDefinition(decisionRequirementsDefinitionId);
if (authRule.assertScenario(scenario)) {
assertNotNull(decisionRequirementsDefinition);
}
}
Aggregations