@Override public Void execute(CommandContext commandContext) { // camunda-admin should access data from all tenants assertThat(commandContext.getTenantManager().isTenantCheckEnabled(), is(false)); return null; } });
@Override public Void execute(CommandContext commandContext) { // cannot enable tenant check for command when it is disabled for process engine commandContext.enableTenantCheck(); assertThat(commandContext.getTenantManager().isTenantCheckEnabled(), is(false)); return null; } });
@Override public void checkDeleteProcessDefinitionById(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("delete the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkUpdateRetriesProcessInstanceByProcessDefinitionId(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
public void checkReadProcessInstance(String processInstanceId) { if (getTenantManager().isTenantCheckEnabled()) { ExecutionEntity execution = findExecutionById(processInstanceId); if (execution != null && !getTenantManager().isAuthenticatedTenant(execution.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("read the process instance '"+ processInstanceId + "'"); } } }
@Override public Void execute(CommandContext commandContext) { // assert that it is enabled again for further commands assertThat(commandContext.isTenantCheckEnabled(), is(true)); assertThat(commandContext.getTenantManager().isTenantCheckEnabled(), is(true)); return null; } });
@Override public void checkUpdateProcessInstanceById(String processInstanceId) { if (getTenantManager().isTenantCheckEnabled()) { ExecutionEntity execution = findExecutionById(processInstanceId); if (execution != null && !getTenantManager().isAuthenticatedTenant(execution.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process instance '"+ processInstanceId + "'"); } } }
@Override public void checkUpdateProcessDefinitionById(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkDeleteDeployment(String deploymentId) { if (getTenantManager().isTenantCheckEnabled()) { DeploymentEntity deployment = findDeploymentById(deploymentId); if (deployment != null && !getTenantManager().isAuthenticatedTenant(deployment.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("delete the deployment '"+ deploymentId + "'"); } } }
@Override public void checkUpdateDecisionDefinitionById(String decisionDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { DecisionDefinitionEntity decisionDefinition = findLatestDecisionDefinitionById(decisionDefinitionId); if (decisionDefinition != null && !getTenantManager().isAuthenticatedTenant(decisionDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the decision definition '"+ decisionDefinitionId + "'"); } } }
@Override public void checkDeleteProcessDefinitionById(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("delete the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkUpdateProcessInstanceByProcessDefinitionId(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkUpdateRetriesProcessInstanceByProcessDefinitionId(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkUpdateProcessDefinitionById(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkReadDeployment(String deploymentId) { if (getTenantManager().isTenantCheckEnabled()) { DeploymentEntity deployment = findDeploymentById(deploymentId); if (deployment != null && !getTenantManager().isAuthenticatedTenant(deployment.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("get the deployment '"+ deploymentId + "'"); } } }
@Override public void checkDeleteDeployment(String deploymentId) { if (getTenantManager().isTenantCheckEnabled()) { DeploymentEntity deployment = findDeploymentById(deploymentId); if (deployment != null && !getTenantManager().isAuthenticatedTenant(deployment.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("delete the deployment '"+ deploymentId + "'"); } } }
@Override public void checkUpdateProcessInstanceByProcessDefinitionId(String processDefinitionId) { if (getTenantManager().isTenantCheckEnabled()) { ProcessDefinitionEntity processDefinition = findLatestProcessDefinitionById(processDefinitionId); if (processDefinition != null && !getTenantManager().isAuthenticatedTenant(processDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process definition '"+ processDefinitionId + "'"); } } }
@Override public void checkReadDeployment(String deploymentId) { if (getTenantManager().isTenantCheckEnabled()) { DeploymentEntity deployment = findDeploymentById(deploymentId); if (deployment != null && !getTenantManager().isAuthenticatedTenant(deployment.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("get the deployment '"+ deploymentId + "'"); } } }
@Override public void checkUpdateProcessInstanceById(String processInstanceId) { if (getTenantManager().isTenantCheckEnabled()) { ExecutionEntity execution = findExecutionById(processInstanceId); if (execution != null && !getTenantManager().isAuthenticatedTenant(execution.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("update the process instance '"+ processInstanceId + "'"); } } }
public void configureTenantCheck(TenantCheck tenantCheck) { if (isTenantCheckEnabled()) { Authentication currentAuthentication = getCurrentAuthentication(); tenantCheck.setTenantCheckEnabled(true); tenantCheck.setAuthTenantIds(currentAuthentication.getTenantIds()); } else { tenantCheck.setTenantCheckEnabled(false); tenantCheck.setAuthTenantIds(null); } }