davidstrauss / google-drive-recursive-ownership

Tool to recursively give away file and document ownership to another user.
MIT License
268 stars 68 forks source link

Permission Denied #9

Open Luperi opened 8 years ago

Luperi commented 8 years ago

I'm on my Mac and i'm executing the script in this way: python transfer.py /Users/luca/Google\ Drive/New_Folder\ Custom/ true

When I run the script I get the error below.

schermata 2016-08-03 alle 20 05 57
helio-silva commented 7 years ago

Got insufficient permissions Item folder/subfolder/photoHiRes.jpg needs ownership granted. Upgrading existing permissions to ownership. and them this error: An error occurred updating ownership permissions: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0B9Y3CeAxHt4RVU5Qd216MWwtS1E/permissions/16600970269708598941?alt=json&transferOwnership=true returned "Insufficient permissions for this file">

Paraka321 commented 7 years ago

Luperi, are you still having this issue?

helio-silva, can I get some more information from you? It looks like you are trying to change permissions on a jpg file. Are you using a personal gmail account (ends in @gmail.com) or are you part of a school/business/government organization that uses gmail to check email for accounts that do not end in @gmail.com? If you are using a personal account or G-Suite for Business account you will not be able to change permissions on a jpg file with this tool. This is hard-coded into Google's permission scheme; you can only change permission on Google-based documents (Docs, Sheets, Slides, etc). See the README for more information.

davidstrauss commented 7 years ago

If you are using a personal account or G-Suite for Business account you will not be able to change permissions on a jpg file with this tool. This is hard-coded into Google's permission scheme; you can only change permission on Google-based documents (Docs, Sheets, Slides, etc). See the README for more information.

I don't believe this is correct. I originally wrote this script (and used it) to hand off ownership of objects including non-Google-documents from one user within a G Suite organization to another.

What I think this script can't do is hand-off ownership between non-G Suite accounts or G Suite accounts that are part of different organization.

Paraka321 commented 7 years ago

I don't believe this is correct. I originally wrote this script (and used it) to hand off ownership of objects including non-Google-documents from one user within a G Suite organization to another.

What I think this script can't do is hand-off ownership between non-G Suite accounts or G Suite accounts that are part of different organization.

I think on one of the other issue threads we talked about this. If I remember correctly you created this while working under a G Suite domain, which causes all of the pieces to work as expected. Personal Gmail accounts can only move files that were 'created' by the user, not 'uploaded' by the user. Since the only files that can be created are Google files, personal accounts can only change permissions on Google files. This is not something that can even be done manually through the GUI and it is unlikely that the API would allow this extra functionality.

You are correct that permissions cannot be changed across domains. This is also hard-coded into Google's permissions.

davidstrauss commented 7 years ago

I think on one of the other issue threads we talked about this. If I remember correctly you created this while working under a G Suite domain, which causes all of the pieces to work as expected. Personal Gmail accounts can only move files that were 'created' by the user, not 'uploaded' by the user. Since the only files that can be created are Google files, personal accounts can only change permissions on Google files. This is not something that can even be done manually through the GUI and it is unlikely that the API would allow this extra functionality.

Yes, this is all correct. I was correcting this comment that you posted earlier:

If you are using a personal account or G-Suite for Business account you will not be able to change permissions on a jpg file with this tool.

This tool should work for moving ownership of a JPG file between users in a G Suite account. Did you mean to say "between a G Suite user and a personal account"?

Paraka321 commented 7 years ago

This tool should work for moving ownership of a JPG file between users in a G Suite account.

I just tried testing a JPG with a personal gmail account to another personal gmail account. I was unable to move it with the script or from the GUI. Instead I get the following error:

Item test\File_000.jpeg needs ownership granted. Upgrading existing permissions to ownership. An error occurred updating ownership permissions: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0B-kZ41hEUm_8aGxFM3hyTVFCbVk/permissions/03173207988037715799?alt=json&transferOwnership=true returned "Insufficient permissions for this file">

davidstrauss commented 7 years ago

I just tried testing a JPG with a personal gmail account to another personal gmail account. I was unable to move it with the script or from the GUI.

I think you need to review what I'm saying. I never said that would work. (Rather, I said it wouldn't.) The tool works to move documents and regular files between users in a G Suite organization.

It does not work (and cannot work) to move ownership of regular files (like JPGs):

Paraka321 commented 7 years ago

I don't believe this is correct.

I think this is the source of my confusion and the start of our discussion.

It does not work (and cannot work) to move ownership of regular files (like JPGs):

  • Between two personal Google accounts.
  • Between a personal Google account and a G Suite account.
  • Between G Suite accounts in different organizations.

This is correct. That is what I was trying to communicate.

helio-silva commented 7 years ago

Got insufficient permissions Item folder/subfolder/photoHiRes.jpg needs ownership granted. Upgrading existing permissions to ownership. and them this error: An error occurred updating ownership permissions: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0B9Y3CeAxHt4RVU5Qd216MWwtS1E/permissions/16600970269708598941?alt=json&transferOwnership=true returned "Insufficient permissions for this file">

helio-silva commented 7 years ago

I'm a photographer using my personal account at google drive to share jpeg's with family and friends. Since my disk space started to shrink I'm trying to find a way change ownership of these photos.

Paraka321 commented 7 years ago

Got insufficient permissions Item folder/subfolder/photoHiRes.jpg needs ownership granted.

@helio-silva That looks like the error I posted above. See the conversation above. One of the three situations outlined by @davidstrauss must be true.

Paraka321 commented 7 years ago

I'm a photographer using my personal account at google drive to share jpeg's with family and friends. Since my disk space started to shrink I'm trying to find a way change ownership of these photos.

Google does not allow for this. You will not be able to use this project to circumvent Google's permissions.

helio-silva commented 7 years ago

Even moving data to other accounts I'm still owner of jpeg. It looks like Google Drive is a trap for photographers I should move to other service thank you guys for your help and nice shared code.