Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#getIdentityService()
The following examples show how to use
org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#getIdentityService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceAuthorizationProviderTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void initializeProcessEngine() { super.initializeProcessEngine(); processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration(); processEngineConfiguration.setResourceAuthorizationProvider(new MyResourceAuthorizationProvider()); identityService = processEngineConfiguration.getIdentityService(); authorizationService = processEngineConfiguration.getAuthorizationService(); user = createUser(userId); group = createGroup(groupId); identityService.createMembership(userId, groupId); identityService.setAuthentication(userId, Arrays.asList(groupId)); processEngineConfiguration.setAuthorizationEnabled(true); }
Example 2
Source File: DefaultAuthorizationProvider.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public AuthorizationEntity[] newDeployment(Deployment deployment) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); if (currentAuthentication != null && currentAuthentication.getUserId() != null) { String userId = currentAuthentication.getUserId(); String deploymentId = deployment.getId(); AuthorizationEntity authorization = createGrantAuthorization(userId, null, DEPLOYMENT, deploymentId, READ, DELETE); return new AuthorizationEntity[]{ authorization }; } return null; }
Example 3
Source File: QueryMaxResultsLimitUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected static String getAuthenticatedUserId( ProcessEngineConfigurationImpl processEngineConfig) { IdentityService identityService = processEngineConfig.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); if(currentAuthentication == null) { return null; } else { return currentAuthentication.getUserId(); } }
Example 4
Source File: MyStartFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); }
Example 5
Source File: MyStartFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public StartFormData createStartFormData(ProcessDefinitionEntity processDefinition) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); StartFormDataImpl result = new StartFormDataImpl(); result.setProcessDefinition(processDefinition); return result; }
Example 6
Source File: MyFormFieldValidator.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public boolean validate(Object submittedValue, FormFieldValidatorContext validatorContext) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); return true; }
Example 7
Source File: MyTaskFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); }
Example 8
Source File: MyTaskFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TaskFormData createTaskForm(TaskEntity task) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); TaskFormDataImpl result = new TaskFormDataImpl(); result.setTask(task); return result; }
Example 9
Source File: ProcessEngineImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public ProcessEngineImpl(ProcessEngineConfigurationImpl processEngineConfiguration) { this.processEngineConfiguration = processEngineConfiguration; this.name = processEngineConfiguration.getProcessEngineName(); this.repositoryService = processEngineConfiguration.getRepositoryService(); this.runtimeService = processEngineConfiguration.getRuntimeService(); this.historicDataService = processEngineConfiguration.getHistoryService(); this.identityService = processEngineConfiguration.getIdentityService(); this.taskService = processEngineConfiguration.getTaskService(); this.formService = processEngineConfiguration.getFormService(); this.managementService = processEngineConfiguration.getManagementService(); this.authorizationService = processEngineConfiguration.getAuthorizationService(); this.caseService = processEngineConfiguration.getCaseService(); this.filterService = processEngineConfiguration.getFilterService(); this.externalTaskService = processEngineConfiguration.getExternalTaskService(); this.decisionService = processEngineConfiguration.getDecisionService(); this.databaseSchemaUpdate = processEngineConfiguration.getDatabaseSchemaUpdate(); this.jobExecutor = processEngineConfiguration.getJobExecutor(); this.commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired(); commandExecutorSchemaOperations = processEngineConfiguration.getCommandExecutorSchemaOperations(); this.sessionFactories = processEngineConfiguration.getSessionFactories(); this.historyLevel = processEngineConfiguration.getHistoryLevel(); this.transactionContextFactory = processEngineConfiguration.getTransactionContextFactory(); executeSchemaOperations(); if (name == null) { LOG.processEngineCreated(ProcessEngines.NAME_DEFAULT); } else { LOG.processEngineCreated(name); } ProcessEngines.registerProcessEngine(this); if ((jobExecutor != null)) { // register process engine with Job Executor jobExecutor.registerProcessEngine(this); } if (processEngineConfiguration.isMetricsEnabled()) { String reporterId; // only use a deprecated, custom MetricsReporterIdProvider, // if no static hostname AND custom HostnameProvider are set. // See ProcessEngineConfigurationImpl#initHostname() if (processEngineConfiguration.getMetricsReporterIdProvider() != null && processEngineConfiguration.getHostnameProvider() instanceof SimpleIpBasedProvider) { reporterId = processEngineConfiguration.getMetricsReporterIdProvider().provideId(this); } else { reporterId = processEngineConfiguration.getHostname();; } DbMetricsReporter dbMetricsReporter = processEngineConfiguration.getDbMetricsReporter(); dbMetricsReporter.setReporterId(reporterId); if(processEngineConfiguration.isDbMetricsReporterActivate()) { dbMetricsReporter.start(); } } }
Example 10
Source File: ExecuteJobsCmd.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public Void execute(CommandContext commandContext) { ensureNotNull("jobId", jobId); final JobEntity job = commandContext.getDbEntityManager().selectById(JobEntity.class, jobId); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); final IdentityService identityService = processEngineConfiguration.getIdentityService(); final JobExecutorContext jobExecutorContext = Context.getJobExecutorContext(); if (job == null) { if (jobExecutorContext != null) { // CAM-1842 // Job was acquired but does not exist anymore. This is not a problem. // It usually means that the job has been deleted after it was acquired which can happen if the // the activity instance corresponding to the job is cancelled. LOG.debugAcquiredJobNotFound(jobId); return null; } else { throw LOG.jobNotFoundException(jobId); } } jobFailureCollector.setJob(job); if (jobExecutorContext == null) { // if null, then we are not called by the job executor for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateJob(job); } // write a user operation log since we're not called by the job executor commandContext.getOperationLogManager().logJobOperation(UserOperationLogEntry.OPERATION_TYPE_EXECUTE, jobId, job.getJobDefinitionId(), job.getProcessInstanceId(), job.getProcessDefinitionId(), job.getProcessDefinitionKey(), PropertyChange.EMPTY_CHANGE); } else { jobExecutorContext.setCurrentJob(job); // if the job is called by the job executor then set the tenant id of the job // as authenticated tenant to enable tenant checks String tenantId = job.getTenantId(); if (tenantId != null) { identityService.setAuthentication(null, null, Collections.singletonList(tenantId)); } } try { // register as command context close lister to intercept exceptions on flush commandContext.registerCommandContextListener(jobFailureCollector); commandContext.setCurrentJob(job); job.execute(commandContext); } catch (Throwable t) { jobFailureCollector.setFailedActivityId(Context.getCommandInvocationContext().getProcessDataContext().getLatestPropertyValue(ProcessDataContext.PROPERTY_ACTIVITY_ID)); throw t; } finally { if (jobExecutorContext != null) { jobExecutorContext.setCurrentJob(null); identityService.clearAuthentication(); } } return null; }