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

Move a document to Trash, which is already in deleted state, results in permanent Delete.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0-HF12, 7.2
    • Fix Version/s: 6.0-HF13, 7.3
    • Component/s: Core

      Description

      When user login's into multiple browser, say browser1 and browser2.
      Delete the folder from browser1, perform delete again from browser2.

      Instead of moving the document to trash, the document as been permanently deleted.
      Step1: Login into browser1 : Create a Folder TrashTwice under Administrator Workspace.
      Step2: Login into browser2: Navigate to Administrator Workspace.
      Step3: browser1: Perform delete operation on TrashTwice folder.
      Step4: browser2: Since browser is not yet refresh, TrashTwice folder will still be visible, perform delete operation on it.
      Acutal Result: TrashTwice Folder is not present in Trash.

      Expected Result: TrashTwice Folder should be present in Trash

      Indeed:

      @Override
          public void trashDocuments(List<DocumentModel> docs) throws ClientException {
              if (docs.isEmpty()) {
                  return;
              }
              CoreSession session = docs.get(0).getCoreSession();
              for (DocumentModel doc : docs) {
                  DocumentRef docRef = doc.getRef();
                  if (session.getAllowedStateTransitions(docRef).contains(LifeCycleConstants.DELETE_TRANSITION)
                          && !doc.isProxy()) {
                      if (!session.canRemoveDocument(docRef)) {
                          throw new DocumentSecurityException("User " + session.getPrincipal().getName()
                                  + " does not have the permission to remove the document " + doc.getId() + " ("
                                  + doc.getPath() + ")");
                      }
                      trashDocument(session, doc);
                  } else {
                      log.warn("Document " + doc.getId() + " of type " + doc.getType() + " in state "
                              + doc.getCurrentLifeCycleState() + " does not support transition "
                              + LifeCycleConstants.DELETE_TRANSITION + ", it will be deleted immediately");
                      session.removeDocument(docRef);
                  }
              }
              session.save();
          }
      

      will consider that the document does not support transition.

      A natural fix could be to do nothing (but refresh the content view) if the current state is already 'deleted'.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: