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

Fix missing current principal in DownloadService

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.10
    • Fix Version/s: 10.10-HF15, 11.1, 2021.0
    • Component/s: Automation
    • Release Notes Summary:
      Current user is available when evaluating a filter for a download.
    • Backlog priority:
      250
    • Sprint:
      nxsupport 11.1.4
    • Story Points:
      1

      Description

      Steps to reproduce :

      1. contribute a contribution to check the permission during the download
        <extension target="org.nuxeo.ecm.core.io.download.DownloadService" point="permissions">
          <permission name="Read">
            <script language="JavaScript">
              function run() {
                print("----------------- Start check permissions for DownloadService -----------------");
                print("reason " + Reason);
                print("rendition " + Rendition);
                print("doc " + (Document == null ? "null" : Document.getId()));
                print("filename " + (Blob == null ? "null" : Blob.getFilename()));
                print("xpath " + XPath);
                var userName = null;
                if (CurrentUser != null) {
                  // CurrentUser can be null during the BulkAction
                  userName = CurrentUser.getName();
                  print("user " + userName);
                }
                return true;
              }
            </script>
            </permission>
        </extension>
        
      1. Navigate to a workspace
      2. Select the action "Download All as ZIP"
      3. Observe the following traces in the logs
        ----------------- Start check permissions for DownloadService -----------------
        reason download
        rendition null
        doc eb4b4df8-706c-49aa-868d-e4a45bb538a1
        filename CPP.zip
        xpath null
        

        => the current user is not displayed, which means that it's missing to evaluate the permissions when downloading in this case

      Expected behavior: it should be possible to check the current principal in any case

      The problem is related to the way AsyncOperationAdapter starts a new thread to do the asynchronous (bulk) download.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 15 minutes
                1h 15m