Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-6431

UserOperationLogManager overwrites userId set on UserOperationLogContext

    Details

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

      Description

      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());
      }
      

        Activity

        Hide
        jan.galinski@holisticon.de Jan Galinski added a comment -

        Cool. I updated the test case, please check https://github.com/camunda/camunda-bpm-platform/pull/236/files

        Show
        jan.galinski@holisticon.de Jan Galinski added a comment - Cool. I updated the test case, please check https://github.com/camunda/camunda-bpm-platform/pull/236/files
        Hide
        askar.akhmerov Askar Akhmerov added a comment -

        Hi Jan,

        merged, thank you for the contribution.

        Cheers,
        Askar.

        Show
        askar.akhmerov Askar Akhmerov added a comment - Hi Jan, merged, thank you for the contribution. Cheers, Askar.
        Hide
        jan.galinski@holisticon.de Jan Galinski added a comment -

        Will this only come with 7.6? I am using an ugly workaround (custom read only identityService) in a customer project and would love to have this on an ee-patch.

        Show
        jan.galinski@holisticon.de Jan Galinski added a comment - Will this only come with 7.6? I am using an ugly workaround (custom read only identityService) in a customer project and would love to have this on an ee-patch.
        Hide
        askar.akhmerov Askar Akhmerov added a comment -

        Hi Jan,

        we will decide on Monday.

        Best regards,
        Askar

        Show
        askar.akhmerov Askar Akhmerov added a comment - Hi Jan, we will decide on Monday. Best regards, Askar
        Hide
        askar.akhmerov Askar Akhmerov added a comment -

        picked to 7.5, will be released with next patch.

        Show
        askar.akhmerov Askar Akhmerov added a comment - picked to 7.5, will be released with next patch.

          People

          • Assignee:
            Unassigned
            Reporter:
            jan.galinski@holisticon.de Jan Galinski
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: