UserOperationLogManager overwrites userId set on UserOperationLogContext

XMLWordPrintable

    • Type: Bug Report
    • Resolution: Fixed
    • Priority: L3 - Default
    • 7.6.0, 7.5.4, 7.6.0-alpha3
    • Affects Version/s: 7.5.1
    • Component/s: engine
    • None

      I am using CommandContext.getOperationLOgManager() to write custom Operation Log entries.

      However, though I set a UserId on the OpLogContext.setUserId, it gets overwritten in

      protected void fireUserOperationLog(final UserOperationLogContext context) {
          context.setUserId(getAuthenticatedUserId());
      
          HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
            @Override
            public List<HistoryEvent> createHistoryEvents(HistoryEventProducer producer) {
              return producer.createUserOperationLogEvents(context);
            }
          });
        }
      

      This is not the desired behavior since we do not use IdentityService functions. I guess a simple and valid fix would be to set the userId only when it has not been set before:

      if (context.getUserId() == null) {
          context.setUserId(getAuthenticatedUserId());
      }
      

            Assignee:
            Unassigned
            Reporter:
            Jan Galinski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: