Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-521

Cannot Drive Edit a synchronized file flagged as readonly because Remove permission not granted server-side

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.113
    • Component/s: Direct Edit
    • Sprint:
      drive-8.1-3

      Description

      Let's say a user has Read/Write permission on a document but not Remove, because permissions have been overridden for Remove to be included in Manage Everything instead of Write.

      If a user synchronizes the parent folder of the document it will be flagged as readonly on the file system, because of:

      def _synchronize_remotely_created(self, doc_pair, local_client, remote_client):
          ...
          self._handle_readonly(local_client, doc_pair)
      
      def _handle_readonly(self, local_client, doc_pair):
          ...
          if doc_pair.is_readonly():
              local_client.set_readonly(doc_pair.local_path) 
      
      class StateRow(CustomRow):
      
          def is_readonly(self):
              if self.folderish:
                  return self.remote_can_create_child == 0
              else:
                  return (self.remote_can_delete & self.remote_can_rename
                              & self.remote_can_update) == 0
      

      Yet the user can Drive Edit the document since it has Write permission on it:

      public class NuxeoDriveActions
          public boolean canEditDocument(DocumentModel doc) {
              ...
              if (!documentManager.hasPermission(doc.getRef(), SecurityConstants.WRITE)) {
                  return false;
              }
             ...
          }
      

      When doing so, since the file exists on the file system it is copied from the locally synchronized folder to the temporary edit folder, with its readonly flag.
      => Can be opened but not updated by Word for instance.
      Then at second edition we get an error when Drive tries to remove the previously downloaded file:

      2016-01-11 10:46:19,484 9960 8372 ERROR    nxdrive.commandline Error executing 'launch': [Error 5] Acc\E8s refus: u'C:\\Users\\planglais\\AppData\\Roaming\\SPB_Data\\.nuxeo-drive\\edit\\ee3b1c13-b27a-42b7-9080-3e26c5e039ac\\DocNuxeo.docx'
      Traceback (most recent call last):
        File "nuxeo-drive-client\nxdrive\commandline.py", line 465, in handle
        File "nuxeo-drive-client\nxdrive\commandline.py", line 494, in launch
        File "nuxeo-drive-client\nxdrive\drive_edit.py", line 100, in handle_url
        File "nuxeo-drive-client\nxdrive\drive_edit.py", line 227, in edit
        File "nuxeo-drive-client\nxdrive\drive_edit.py", line 213, in _prepare_edit
      WindowsError: [Error 5] Acc\E8s refus: u'C:\\Users\\myuser\\AppData\\Roaming\\SPB_Data\\.nuxeo-drive\\edit\\ee3b1c13-b27a-42b7-9080-3e26c5e039ac\\DocNuxeo.docx'
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: