Reputation: 3096
My company has several shared Google Drives and each of those are shared among different teams. I want to upload data to one of those drives using a Python script. More precisely, I want to upload to a specific folder in a drive and not to any other location. So the Python script should only have minimal permissions because I don't want my Python script to wreak havoc on the drive.
Is it possible to grant an application permissions on a folder level? If not, what would be the best strategy to tackle the file upload (e.g. a new shared drive, mounting a bucket in google drive)?
I already looked for information here, here, here and other places, but could not find any useful information.
Upvotes: 2
Views: 209
Reputation: 15357
While it isn't possible to grant permissions to only one folder for a user, it is possible to achieve this with a Service Account, or by restricting the scopes of your script.
Service Accounts aren't the same as users as for as Google API interaction goes, and it is possible to give a Service Account access to a single folder of choice rather than full Drive access. If your script is therefore run by a service account, it is possible to limit the access scope of your script.
Alternatively, the https://www.googleapis.com/auth/drive.file
scope gives your application the ability to only manage Google Drive files and folders which have been opened or created by the App itself.
Upvotes: 1
Reputation: 116868
Is it possible to grant an application permissions on a folder level?
When an application is granted access to google drive its to the full drive account. Read, write access would be to the full account you cant lock it to a folder
Upvotes: 1