Example #1
0
        public virtual void logAuthorizationOperation(string operation, AuthorizationEntity authorization, AuthorizationEntity previousValues)
        {
            if (UserOperationLogEnabled)
            {
                IList <PropertyChange> propertyChanges = new List <PropertyChange>();
                propertyChanges.Add(new PropertyChange("permissionBits", previousValues == null ? null : previousValues.getPermissions(), authorization.getPermissions()));
                propertyChanges.Add(new PropertyChange("permissions", previousValues == null ? null : getPermissionStringList(previousValues), getPermissionStringList(authorization)));
                propertyChanges.Add(new PropertyChange("type", previousValues == null ? null : previousValues.AuthorizationType, authorization.AuthorizationType));
                propertyChanges.Add(new PropertyChange("resource", previousValues == null ? null : getResourceName(previousValues.ResourceType), getResourceName(authorization.ResourceType)));
                propertyChanges.Add(new PropertyChange("resourceId", previousValues == null ? null : previousValues.ResourceId, authorization.ResourceId));
                if (!string.ReferenceEquals(authorization.UserId, null) || (previousValues != null && !string.ReferenceEquals(previousValues.UserId, null)))
                {
                    propertyChanges.Add(new PropertyChange("userId", previousValues == null ? null : previousValues.UserId, authorization.UserId));
                }
                if (!string.ReferenceEquals(authorization.GroupId, null) || (previousValues != null && !string.ReferenceEquals(previousValues.GroupId, null)))
                {
                    propertyChanges.Add(new PropertyChange("groupId", previousValues == null ? null : previousValues.GroupId, authorization.GroupId));
                }

                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.AUTHORIZATION).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN);
                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #2
0
        public virtual void logJobDefinitionOperation(string operation, string jobDefinitionId, string processDefinitionId, string processDefinitionKey, PropertyChange propertyChange)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.JOB_DEFINITION).jobDefinitionId(jobDefinitionId).processDefinitionId(processDefinitionId).processDefinitionKey(processDefinitionKey).propertyChanges(propertyChange).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                if (!string.ReferenceEquals(jobDefinitionId, null))
                {
                    JobDefinitionEntity jobDefinition = JobDefinitionManager.findById(jobDefinitionId);
                    // Backward compatibility
                    if (jobDefinition != null)
                    {
                        entryBuilder.inContextOf(jobDefinition);
                    }
                }
                else if (!string.ReferenceEquals(processDefinitionId, null))
                {
                    ProcessDefinitionEntity definition = ProcessDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
                    // Backward compatibility
                    if (definition != null)
                    {
                        entryBuilder.inContextOf(definition);
                    }
                }

                context.addEntry(entryBuilder.create());

                fireUserOperationLog(context);
            }
        }
Example #3
0
        public virtual void logExternalTaskOperation(string operation, ExternalTaskEntity externalTask, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.EXTERNAL_TASK).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                if (externalTask != null)
                {
                    ExecutionEntity         instance   = null;
                    ProcessDefinitionEntity definition = null;
                    if (!string.ReferenceEquals(externalTask.ProcessInstanceId, null))
                    {
                        instance = ProcessInstanceManager.findExecutionById(externalTask.ProcessInstanceId);
                    }
                    else if (!string.ReferenceEquals(externalTask.ProcessDefinitionId, null))
                    {
                        definition = ProcessDefinitionManager.findLatestProcessDefinitionById(externalTask.ProcessDefinitionId);
                    }
                    entryBuilder.processInstanceId(externalTask.ProcessInstanceId).processDefinitionId(externalTask.ProcessDefinitionId).processDefinitionKey(externalTask.ProcessDefinitionKey).inContextOf(externalTask, instance, definition);
                }

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #4
0
        public virtual void logProcessInstanceOperation(string operation, string processInstanceId, string processDefinitionId, string processDefinitionKey, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.PROCESS_INSTANCE).propertyChanges(propertyChanges).processInstanceId(processInstanceId).processDefinitionId(processDefinitionId).processDefinitionKey(processDefinitionKey).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                if (!string.ReferenceEquals(processInstanceId, null))
                {
                    ExecutionEntity instance = ProcessInstanceManager.findExecutionById(processInstanceId);

                    if (instance != null)
                    {
                        entryBuilder.inContextOf(instance);
                    }
                }
                else if (!string.ReferenceEquals(processDefinitionId, null))
                {
                    ProcessDefinitionEntity definition = ProcessDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
                    if (definition != null)
                    {
                        entryBuilder.inContextOf(definition);
                    }
                }

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #5
0
        public virtual void logMembershipOperation(string operation, string userId, string groupId, string tenantId)
        {
            if (!string.ReferenceEquals(operation, null) && UserOperationLogEnabled)
            {
                string entityType = string.ReferenceEquals(tenantId, null) ? EntityTypes.GROUP_MEMBERSHIP : EntityTypes.TENANT_MEMBERSHIP;

                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, entityType).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN);
                IList <PropertyChange> propertyChanges           = new List <PropertyChange>();
                if (!string.ReferenceEquals(userId, null))
                {
                    propertyChanges.Add(new PropertyChange("userId", null, userId));
                }
                if (!string.ReferenceEquals(groupId, null))
                {
                    propertyChanges.Add(new PropertyChange("groupId", null, groupId));
                }
                if (!string.ReferenceEquals(tenantId, null))
                {
                    propertyChanges.Add(new PropertyChange("tenantId", null, tenantId));
                }
                entryBuilder.propertyChanges(propertyChanges);

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #6
0
 public virtual void logPropertyOperation(string operation, IList <PropertyChange> propertyChanges)
 {
     if (UserOperationLogEnabled)
     {
         UserOperationLogContext             context      = new UserOperationLogContext();
         UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.PROPERTY).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN);
         context.addEntry(entryBuilder.create());
         fireUserOperationLog(context);
     }
 }
Example #7
0
 public virtual void logFilterOperation(string operation, string filterId)
 {
     if (UserOperationLogEnabled)
     {
         UserOperationLogContext             context      = new UserOperationLogContext();
         UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.FILTER).propertyChanges(new PropertyChange("filterId", null, filterId)).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER);
         context.addEntry(entryBuilder.create());
         fireUserOperationLog(context);
     }
 }
Example #8
0
        public virtual void logDecisionDefinitionOperation(string operation, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.DECISION_DEFINITION).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #9
0
        public virtual void logCaseInstanceOperation(string operation, string caseInstanceId, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.CASE_INSTANCE).caseInstanceId(caseInstanceId).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #10
0
        public virtual void logLinkOperation(string operation, TaskEntity task, PropertyChange propertyChange)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.IDENTITY_LINK).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER).inContextOf(task, Arrays.asList(propertyChange));

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #11
0
        public virtual void logTaskOperations(string operation, HistoricTaskInstance historicTask, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.TASK).inContextOf(historicTask, propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #12
0
        public virtual void logTenantOperation(string operation, string tenantId)
        {
            if (!string.ReferenceEquals(operation, null) && UserOperationLogEnabled)
            {
                UserOperationLogContext             context      = new UserOperationLogContext();
                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.TENANT).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN).propertyChanges(new PropertyChange("tenantId", null, tenantId));

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #13
0
        public virtual void logDeploymentOperation(string operation, string deploymentId, IList <PropertyChange> propertyChanges)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext context = new UserOperationLogContext();

                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.DEPLOYMENT).deploymentId(deploymentId).propertyChanges(propertyChanges).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #14
0
        public virtual void logHistoricVariableOperation <T1>(string operation, HistoricVariableInstanceEntity historicVariableInstance, ResourceDefinitionEntity <T1> definition, PropertyChange propertyChange)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext context = new UserOperationLogContext();

                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.VARIABLE).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR).propertyChanges(propertyChange).inContextOf(historicVariableInstance, definition, Arrays.asList(propertyChange));

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }
Example #15
0
        public virtual void logAttachmentOperation(string operation, ExecutionEntity processInstance, PropertyChange propertyChange)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext context = new UserOperationLogContext();

                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.ATTACHMENT).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER).inContextOf(processInstance, Arrays.asList(propertyChange));
                context.addEntry(entryBuilder.create());

                fireUserOperationLog(context);
            }
        }
Example #16
0
        public virtual void logVariableOperation(string operation, string executionId, string taskId, PropertyChange propertyChange)
        {
            if (UserOperationLogEnabled)
            {
                UserOperationLogContext context = new UserOperationLogContext();

                UserOperationLogContextEntryBuilder entryBuilder = UserOperationLogContextEntryBuilder.entry(operation, EntityTypes.VARIABLE).propertyChanges(propertyChange);

                if (!string.ReferenceEquals(executionId, null))
                {
                    ExecutionEntity execution = ProcessInstanceManager.findExecutionById(executionId);
                    entryBuilder.inContextOf(execution).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR);
                }
                else if (!string.ReferenceEquals(taskId, null))
                {
                    TaskEntity task = TaskManager.findTaskById(taskId);
                    entryBuilder.inContextOf(task, Arrays.asList(propertyChange)).category(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_TASK_WORKER);
                }

                context.addEntry(entryBuilder.create());
                fireUserOperationLog(context);
            }
        }