Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30956

Unexpected system principal in sessions triggered by comment creation events

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2021.17
    • Fix Version/s: None
    • Component/s: Automation, Comments

      Description

      When creating a comment, automation scripts triggered by the following events are run as the "system" principal instead of the acting user i.e.

      On CommentRoot:

      • aboutToCreate
      • beforeDocumentSecurityModification
      • documentSecurityUpdated
      • documentCreated

      On Comment:

      • aboutToCreate
      • documentCreated
      • beforeDocumentModification (to update relatedtextresources)
      • documentModified

      On original document:

      • commentAdded

      I'm particularly binding to the commentAdded event. I believe this session's principal should be the acting user, not "system".

      Workaround:

      Instead of using:

      • CurrentUser.getPrincipal()
      • Session.getPrincipal()
      • input.doc.getPrincipal()

      Use one of:

      • var actingUser = ctx.Event.context.getPrincipal();
      • var userManager = Fn.getUserManager();
        var principal = Session.getPrincipal();
        var actingName = principal.getActingUser();
        var actingUser = userManager.getPrincipal(actingName);

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              msaye Mark Saye
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: