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

Nuxeo Synchonization Root folders registrations and unregistrations are not propagated to the client

    XMLWordPrintable

    Details

    • Tags:
    • Backlog priority:
      600

      Description

      Using the service method:

      driveManager.unregisterSynchronizationRoot(
                              new NuxeoPrincipalImpl(
                                      (String) subscription.get("username")), doc,
                              session);
      

      It works if the principal of the coreSession is the same principal passed as the method argument.

      A usecase could be a scheduler that needs to unregister all root folders that hasn't been changed since 2 months.
      The scheduler would use an unrestricted session to make the query and would get the principal username through drive:subscriptions schema.

      The unregistration is just working fine but AbstractSyncRootFolderItemFactory [line: 120] - isFileSystemItem(DocumentModel, boolean)

       Principal principal = doc.getCoreSession().getPrincipal();
              boolean isSyncRoot = nuxeoDriveManager.isSynchronizationRoot(principal,
                      doc);
      

      is not using the principal passed as argument of the unregister method. In our usecase, system user is used instead and this user doesn't have any synchronizationRoot indeed.

      The result is that the audit logging is never done and the Drive client is not updated. A RootlessItemException is thrown (see NuxeoDriveFileSystemDeletionListener [line: 98] - logDeletionEvent(DocumentModel, Principal, String))

      FileSystemItem fsItem = null;
              try {
                  fsItem = Framework.getLocalService(
                          FileSystemItemAdapterService.class).getFileSystemItem(doc,
                          true);
              } catch (RootlessItemException e) {
                  // can happen when deleting a folder under and unregistered root:
                  // nothing to do
                  return;
              }
              if (fsItem == null) {
                  return;
              }
      
              LogEntry entry = logger.newLogEntry();
              entry.setEventId(NuxeoDriveEvents.DELETED_EVENT);
      ...
      

      A good fix would be to add a Principal arguments to org.nuxeo.drive.service.FileSystemItemFactory.getFileSystemItem(DocumentModel)

      We can also keep the current method and if no Principal is provided, use the coresession ones so we don't break to much things.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour Time Not Required
                  1h