git-annex-remote-googledrive icon indicating copy to clipboard operation
git-annex-remote-googledrive copied to clipboard

Access Team Drives?

Open mforbes opened this issue 5 years ago • 9 comments

I am trying to setup a remote with a folder in a Google Team Drive by specifying the root_id but this does not seem to work. (I get a 404 "File not found error".) I am getting the root id from the URL of the folder when I connect via the web interface, which works for folders in My Drive.

Is there a limitation in the current implementation, or should I be looking into possible security options with my Team Drive setting?

References:

mforbes avatar Jan 15 '19 08:01 mforbes

There is no limitation regarding Team Drives that I'm aware of. The Google Drive API replies with 404 when the user has no access to the specified folder id. Please check the security settings of your Team Drive. If that doesn't help, could you provide a test folder for me?

Lykos153 avatar Jan 15 '19 11:01 Lykos153

Apparently we need some additional code to access folders within a Team Drive by prefix (https://github.com/gsuitedevs/PyDrive/issues/149). But I'd think it should work by root_id without modification:

Once you get the ID, the process for uploading is as usual

Lykos153 avatar Jan 15 '19 12:01 Lykos153

Please try the version from this branch: https://github.com/Lykos153/git-annex-remote-googledrive/tree/team-drives It's a test version only and it's not supposed for productive use. It's just to check if initremote works without errors.

Use it like this: git annex initremote test_remote type=external externaltype=googledrive prefix=testfolder team_drive_id=<your_team_drive_id>

Lykos153 avatar Jan 15 '19 22:01 Lykos153

Yes: running initremote off that branch succeeds without errors.

mforbes avatar Jan 15 '19 23:01 mforbes

I pushed a new version to this branch. Could you please run "git annex testremote --fast" with it using a team_drive_id?

Lykos153 avatar Feb 01 '19 23:02 Lykos153

Sorry for the protracted delay. Yes, this work (see below) but the files are not stored in "Team Drive/testfolder", they are stored in "My Drive/testfolder". (Not sure if this is intended as part of the "do not use for production work" or not...)

$ git annex testremote test_remote --fast
testremote test_remote (generating test keys...) Remote Tests
  unavailable remote
    removeKey:                       git-annex: Cannot run git-annex-remote-!dne! -- It is not installed in PATH (...)
OK
    storeKey:                          Cannot run git-annex-remote-!dne! -- It is not installed in PATH (...)
OK (0.11s)
    checkPresent:                    OK
    retrieveKeyFile:                 OK
    retrieveKeyFileCheap:            OK
  key size Just 1048576; NoChunks; encryption none
    removeKey when not present:      OK (2.35s)
    present False:                   OK (0.58s)
    storeKey:                        OK (5.52s)
    present True:                    OK (0.42s)
    storeKey when already present:   OK
    present True:                    OK (0.48s)
    retrieveKeyFile:                 OK (1.60s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 33%: OK (1.42s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 0:   OK (1.37s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from end: OK (1.39s)
    fsck downloaded object:          OK
    removeKey when present:          OK (1.26s)
    present False:                   OK (0.42s)
  key size Just 1048576; NoChunks; encryption shared
    removeKey when not present:      OK (2.19s)
    present False:                   OK (0.42s)
    storeKey:                        OK (9.36s)
    present True:                    OK (0.44s)
    storeKey when already present:   OK (0.10s)
    present True:                    OK (0.45s)
    retrieveKeyFile:                 OK (1.53s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 33%: OK (1.54s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 0:   OK (1.44s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from end: OK (1.40s)
    fsck downloaded object:          OK
    removeKey when present:          OK (1.19s)
    present False:                   OK (0.49s)
  key size Just 1048575; NoChunks; encryption none
    removeKey when not present:      OK (0.44s)
    present False:                   OK (0.46s)
    storeKey:                        OK (5.53s)
    present True:                    OK (0.42s)
    storeKey when already present:   OK
    present True:                    OK (0.47s)
    retrieveKeyFile:                 OK (1.40s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 33%: OK (1.34s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 0:   OK (1.35s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from end: OK (1.33s)
    fsck downloaded object:          OK
    removeKey when present:          OK (1.18s)
    present False:                   OK (0.47s)
  key size Just 1048575; NoChunks; encryption shared
    removeKey when not present:      OK (0.40s)
    present False:                   OK (0.46s)
    storeKey:                        OK (5.89s)
    present True:                    OK (0.47s)
    storeKey when already present:   OK (0.10s)
    present True:                    OK (0.46s)
    retrieveKeyFile:                 OK (1.59s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 33%: OK (1.56s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from 0:   OK (1.35s)
    fsck downloaded object:          OK
    retrieveKeyFile resume from end: OK (1.40s)
    fsck downloaded object:          OK
    removeKey when present:          OK (1.15s)
    present False:                   OK (0.46s)

All 69 tests passed (67.18s)
ok
(recording state in git...)

mforbes avatar Mar 10 '19 04:03 mforbes

Any update on this issue? I am trying to set up a special remote on Google Drive that can be used (even read-only) by multiple users. As far as I understand Team Drive is the way to go but I suspect the support is still not ready...?

Nevertheless, thanks a lot for creating this piece of software!

emanuele avatar Jul 29 '19 07:07 emanuele

No, it's not yet ready. I'm going to need to rewrite the way to select folders in response to the API lockdown (see #29). In this process, I'm going to implement full support for Team Drives.

Lykos153 avatar Jul 29 '19 13:07 Lykos153

OK, thanks for your answer. Looking forward to seeing the new feature!

emanuele avatar Jul 30 '19 12:07 emanuele