예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogIncidentResolution()
        public virtual void shouldLogIncidentResolution()
        {
            // given
            testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
            Incident        incident        = runtimeService.createIncident("foo", processInstance.Id, "userTask1", "bar");

            assertEquals(0, historyService.createUserOperationLogQuery().count());

            // when
            identityService.AuthenticatedUserId = "userId";
            runtimeService.resolveIncident(incident.Id);
            identityService.clearAuthentication();

            // then
            assertEquals(1, historyService.createUserOperationLogQuery().count());
            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();

            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RESOLVE, entry.OperationType);
            assertEquals(EntityTypes.PROCESS_INSTANCE, entry.EntityType);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, entry.Category);
            assertEquals("incidentId", entry.Property);
            assertNull(entry.OrgValue);
            assertEquals(incident.Id, entry.NewValue);
            assertNull(entry.ExecutionId);
            assertEquals(processInstance.Id, entry.ProcessInstanceId);
            assertEquals(processInstance.ProcessDefinitionId, entry.ProcessDefinitionId);
            assertEquals("Process", entry.ProcessDefinitionKey);
        }
예제 #2
0
        protected internal virtual void assertLogEntry(string property, object newValue)
        {
            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().property(property).singleResult();

            assertThat(entry, notNullValue());
            assertThat(entry.OrgValue, nullValue());
            assertThat(entry.NewValue, @is(newValue.ToString()));
            assertThat(entry.Category, @is(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR));
            assertThat(entry.EntityType, @is(EntityTypes.DECISION_DEFINITION));
            assertThat(entry.OperationType, @is(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_EVALUATE));
        }
예제 #3
0
        protected internal virtual void assertLog(string operation, string entity, string orgValue, string newValue)
        {
            assertEquals(1, query.count());
            UserOperationLogEntry entry = query.singleResult();

            assertEquals(operation, entry.OperationType);
            assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN, entry.Category);
            assertEquals(entity, entry.EntityType);
            assertEquals(orgValue, entry.OrgValue);
            assertEquals(newValue, entry.NewValue);
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SafeVarargs protected final void assertLogs(String operation, String entity, org.apache.commons.lang3.tuple.Triple<String, String, String>... values)
        protected internal void assertLogs(string operation, string entity, params Triple <string, string, string>[] values)
        {
            assertEquals(values.Length, query.count());
            foreach (Triple <string, string, string> valueTriple in values)
            {
                UserOperationLogEntry entry = query.property(valueTriple.Left).singleResult();
                assertEquals(operation, entry.OperationType);
                assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN, entry.Category);
                assertEquals(entity, entry.EntityType);
                assertEquals(valueTriple.Middle, entry.OrgValue);
                assertEquals(valueTriple.Right, entry.NewValue);
            }
        }
예제 #5
0
        public virtual Void execute(CommandContext commandContext)
        {
            ensureNotNull(typeof(NotValidException), "entryId", entryId);

            UserOperationLogEntry entry = commandContext.OperationLogManager.findOperationLogById(entryId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkDeleteUserOperationLog(entry);
            }

            commandContext.OperationLogManager.deleteOperationLogEntryById(entryId);
            return(null);
        }
예제 #6
0
 public virtual void checkDeleteUserOperationLog(UserOperationLogEntry entry)
 {
     /*
      * (1) if entry has a category and a process definition key:
      *   => entry in context of process definition
      *   => check either
      *        DELETE_HISTORY on PROCESS_DEFINITION with processDefinitionKey OR
      *        DELETE on OPERATION_LOG_CATEGORY with category
      *
      * (2) if entry has a category but no process definition key:
      *   => standalone entry (task, job, batch, ...), admin entry (user, tenant, ...) or CMMN related
      *   => check DELETE on OPERATION_LOG_CATEGORY with category
      *
      * (3) if entry has no category but a process definition key:
      *   => pre-7.11.0 entry in context of process definition
      *   => check DELETE_HISTORY on PROCESS_DEFINITION with processDefinitionKey
      *
      * (4) if entry has no category and no process definition key:
      *   => pre-7.11.0 standalone entry (task, job, batch, ...) or CMMN related
      *   => no authorization check like before 7.11.0
      */
     if (entry != null)
     {
         string category             = entry.Category;
         string processDefinitionKey = entry.ProcessDefinitionKey;
         if (!string.ReferenceEquals(category, null) || !string.ReferenceEquals(processDefinitionKey, null))
         {
             CompositePermissionCheck permissionCheck = null;
             if (string.ReferenceEquals(category, null))
             {
                 // case (3)
                 permissionCheck = (new PermissionCheckBuilder()).atomicCheckForResourceId(PROCESS_DEFINITION, processDefinitionKey, DELETE_HISTORY).build();
             }
             else if (string.ReferenceEquals(processDefinitionKey, null))
             {
                 // case (2)
                 permissionCheck = (new PermissionCheckBuilder()).atomicCheckForResourceId(Resources.OPERATION_LOG_CATEGORY, category, UserOperationLogCategoryPermissions.DELETE).build();
             }
             else
             {
                 // case (1)
                 permissionCheck = (new PermissionCheckBuilder()).disjunctive().atomicCheckForResourceId(PROCESS_DEFINITION, processDefinitionKey, DELETE_HISTORY).atomicCheckForResourceId(Resources.OPERATION_LOG_CATEGORY, category, UserOperationLogCategoryPermissions.DELETE).build();
             }
             AuthorizationManager.checkAuthorization(permissionCheck);
         }
         // case (4)
     }
 }
예제 #7
0
        public virtual void shouldCreateUserOperationLogForBatchSuspension()
        {
            // given
            Batch batch = helper.migrateProcessInstancesAsync(1);

            // when
            identityService.AuthenticatedUserId = USER_ID;
            managementService.suspendBatchById(batch.Id);
            identityService.clearAuthentication();

            // then
            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();

            assertNotNull(entry);
            assertEquals(batch.Id, entry.BatchId);
            assertEquals(AbstractSetBatchStateCmd.SUSPENSION_STATE_PROPERTY, entry.Property);
            assertNull(entry.OrgValue);
            assertEquals(org.camunda.bpm.engine.impl.persistence.entity.SuspensionState_Fields.SUSPENDED.Name, entry.NewValue);
        }
예제 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCreateProperty()
        public virtual void testCreateProperty()
        {
            // given
            assertThat(historyService.createUserOperationLogQuery().count(), @is(0L));

            // when
            identityService.AuthenticatedUserId = USER_ID;
            managementService.setProperty(PROPERTY_NAME, "testValue");
            identityService.clearAuthentication();

            // then
            assertThat(historyService.createUserOperationLogQuery().count(), @is(1L));
            UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();

            assertThat(entry.EntityType, @is(EntityTypes.PROPERTY));
            assertThat(entry.Category, @is(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_ADMIN));
            assertThat(entry.OperationType, @is(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE));
            assertThat(entry.Property, @is("name"));
            assertThat(entry.OrgValue, nullValue());
            assertThat(entry.NewValue, @is(PROPERTY_NAME));
        }
예제 #9
0
 public virtual void checkDeleteUserOperationLog(UserOperationLogEntry entry)
 {
     // tenant check is not available for user operation log
 }