Search code examples
permissionsgoogle-drive-apigoogle-drive-shared-drive

Set permissions on a Google Drive folder that allows creating files, but not folders?


Is there a way to create or set permissions on a Google Drive folder that allows users to create or upload files to the folder, but not create additional nested folders? Ultimately I would like users to be able to add files to folders, but not change the overall folder structure.

I've been able to set the role of the user for a folder: https://developers.google.com/drive/api/v3/reference/permissions/create

However, once I give "writer" permission to a user they are able to both upload files and create folders.

https://developers.google.com/drive/api/v3/manage-sharing


Solution

  • Unfortunately, the permission and role functionality combined with the structure of Drive don't allow for the ability to allow users to upload and edit files without also allowing them to change the apparent folder structure of the Drive.

    As stated on the Google Drive REST API Documentation about Permission structures in Drives, a file's permission consists of four parameters:

    1. Permission Type (user/group/domain/anyone)
    2. Email Address accociated with the permission
    3. Domain that has access to the permission
    4. Role

    There are only 5 assignable roles for file permissions, as can been seen in this table: Assignable permission Roles on Google Drive

    Additionally, Google Drive doesn't use a file system, and in actual fact folders in Drive are just files with MIME Type application/vnd.google-apps.folder. You can see this by querying the MIME Type of a folder ID or on the Drive Supported MIME Types reference.