use of org.activiti.api.process.model.payloads.GetProcessDefinitionsPayload in project Activiti by Activiti.
the class ProcessRuntimeImpl method processDefinitions.
@Override
public Page<ProcessDefinition> processDefinitions(Pageable pageable, GetProcessDefinitionsPayload getProcessDefinitionsPayload) {
if (getProcessDefinitionsPayload == null) {
throw new IllegalStateException("payload cannot be null");
}
GetProcessDefinitionsPayload securityKeysInPayload = securityPoliciesManager.restrictProcessDefQuery(SecurityPolicyAccess.READ);
// else ignore and use the user provided ones.
if (!securityKeysInPayload.getProcessDefinitionKeys().isEmpty()) {
getProcessDefinitionsPayload.setProcessDefinitionKeys(securityKeysInPayload.getProcessDefinitionKeys());
}
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
if (getProcessDefinitionsPayload.hasDefinitionKeys()) {
processDefinitionQuery.processDefinitionKeys(getProcessDefinitionsPayload.getProcessDefinitionKeys());
}
List<org.activiti.engine.repository.ProcessDefinition> currentVersionDefinitions = filterCurrentVersionDefinitions(processDefinitionQuery.list());
return new PageImpl<>(processDefinitionConverter.from(currentVersionDefinitions), Math.toIntExact(processDefinitionQuery.count()));
}
use of org.activiti.api.process.model.payloads.GetProcessDefinitionsPayload in project Activiti by Activiti.
the class SecurityPoliciesProcessDefinitionRestrictionApplierTest method restrictToKeysAddFilterOnGivenKeys.
@Test
public void restrictToKeysAddFilterOnGivenKeys() {
// given
Set<String> keys = singleton("procDef");
// when
GetProcessDefinitionsPayload filter = restrictionApplier.restrictToKeys(keys);
// then
assertThat(filter.getProcessDefinitionKeys()).isEqualTo(keys);
}
use of org.activiti.api.process.model.payloads.GetProcessDefinitionsPayload in project Activiti by Activiti.
the class SecurityPoliciesProcessDefinitionRestrictionApplierTest method denyAllShouldAddUnmatchableFilter.
@Test
public void denyAllShouldAddUnmatchableFilter() {
// when
GetProcessDefinitionsPayload filter = restrictionApplier.denyAll();
// then
assertThat(filter.getProcessDefinitionKeys()).hasSize(1);
assertThat(filter.getProcessDefinitionKeys().iterator().next()).startsWith("missing-");
}
Aggregations