Google Drive API - Override Owner in Shared Folder - google-drive-api

When sharing a folder, is it possible for the owner to override permissions of the files other writers have created under the folder? Hopefully this can be done with a normal Google account, but requiring Google Apps access is also OK (as long as we only need the owner's, not an admin's credentials to do so)

As far as I know, files inside the shared folders inherits the sharing permissions set by the folder owner. Which means that, permissions set by file owners were overridden by the permissions set by the folder owner as demonstrated in this YouTube video - Steegle.com - Google Drive & Docs - Sharing.
However, please note that there are only certain operations which the folder owner can permit and this does not include change of ownership of files as given in Types, roles and values: how the permissions work.
This discussion on Sharing folders vs sharing files - which has priority in Google Docs Help Forum might also help.

Related

Transfer files from Google Drive to a different domain

How can I transfer all my files from a google drive account to another google drive account, but from different domain and organisation.
I tried with Transfer Ownership, but I recieve an error when I choose to which user I want to transfer the files.
"Error: Select a user from search results"
Transfer of Ownership with Google Drive
It would be important to clarify at first what is possible and the workarounds. First we need to make sure that your organization has enabled the option to share files with outside users or make it public.
The [transfer of ownership][1] is only available or allowed between users from the same organization.
Method 1 (Make a Copy)
The first method that I suggest is to move all data to a folder from your Drive and share that folder directly with the other user. For example the folder would be under user "A" and you would share it with the user from another domain, the user "B".
Login to with user "B" and check under "Recent" option over, it should be on the left of the Drive UI.
You should be able to access the folder that was recently shared or with the link of the folder (I suggest having the user "B" account under an incognito window). You can start from there picking the files and making a copy, the copy would be under the ownership of user "B".
Method 2 (Shared Drives)
If your new organization or domain has Shared Drives, you should be able to add the external users as "Manager", you would need to add user "A". This way the user "A" would be able to move files directly to the Shared Drive, and due to the Shared drives not having owners but "Managers" or other permissions, the file becomes part of the new organization and is available to be moved by the users of the new organization.
Method 3 (Google Takeout)
If none of these options helps you, you can utilize Google Takeout to download all your Google Data.
You can review how it works below:
https://support.google.com/accounts/answer/3024190
References
https://support.google.com/a/answer/7374057
https://support.google.com/drive/answer/2375091?hl=en&co=GENIE.Platform%3DDesktop#zippy=%2Cmake-a-copy-of-a-file
[1]: https://support.google.com/a/answer/1247799?hl=en
In addition to Ricardo's full answer:
Method 2b (automated)
Even if your Google Workspace has no Shared Drives you might use this method with Google Drive add-on or web-app.

Object level authorisations or ACLs in Google Shared drive

Does Google Shared drive have any object level authorizations or ACLs ?
Currently i only see that there are members of the shared drive and they get apply to all the files and folders in the shared drive.
How do i achieve the following scenario ?
Shared Drive 1
Folder 1
File 1
Folder 2
File 2
I want user A to have access to Folder 1 under Shared Drive 1 and user B to user access to Folder 2. But it seems its not possible in Google shared drive.
Best Regards,
Saurav
You can share a folder under a Shared Drive if you right click on that designated folder and click on the Share Button. Here are a list of scenarios that will happen once it is done:
The user will be notified via email that the folder has been shared.
The user will not have any visibility on the source Shared Drive where that designated folder is located. He will simply have access to the folder and all of its contents.
Another important note to consider for you to be able to achieve this:
Make sure that the Shared drive settings option is set to allow "People who aren't shared drive members can be added to files".
This can be done through the Google Workspace Admin Console under Apps > Google Workspace > Drives and Docs > Manage shared drives. And, on the list of Shared Drives, you should see the settings when you hover over the items on the Shared Drive list.
Reference:
https://support.google.com/a/answer/7662202?hl=en#zippy=%2Crestrict-access-for-an-existing-shared-drive
For further assistance regarding this matter I'd best advise you to contact Google Workspace Support

User with edit privileges made files I own not viewable by me

I shared a folder containing files and subfolders with files with multiple users and gave them edit permissions. One users account has modified the viewing ability(?) of every file and subfolder they had access to. From my account when I open the top level folder I see it empty but I know these files are still there because I own the majority of them and my drive storage amount hasn't changed.
The user claims they have no idea how it happened so maybe that it was an app they unknowingly gave drive access to?
Is there any way I can fix this from the Google Drive web interface? I found Google Apps Scripts has access to the Drive API, should I find a script that can mass change the permissions?
Only the owner can delete the file.
The files were removed from the folder but were not deleted.
Therefore, they take up disk space.
To view files outside the folder, follow these steps:
https://drive.google.com/drive/search?q=is:unorganized%20owner:me
Excuse my bad English
Venca

How do I restore deleted documents from shared Google Drive folders?

A non-privileged Google Drive user has accidentally removed a large number of files from folders shared across an organisation. They do not have permission to delete the files entirely, because they are not the owner. However, users with edit permissions are able to remove a file from a shared folder. This returns the user to the owner, but seems to leave the file orphaned without a parent folder.
The files were owned by various different users.
How do I restore these files to their correct folders? The Google Drive Audit Log does not contain enough information to restore the folders correctly - the parent folder ID is not included with the "Remove from folder" event.
Google Drive is included in the Reports API of the Google Apps Admin SDK. It provides similar information to the Google Drive Audit Log, but with additional metadata. That includes the parent folder ID of files which were removed.
To restore the files you should first query the Reports API for files removed by the user in question over the relevant time period, using the Activities:list method.
Then you'll need to setup a Google Apps service account (which is a little confusing), to allow you to impersonate the owners of the documents that were removed.
Lastly, you can iterate over the event report for the removed files and use the Files: patch method in Google Drive REST API, to re-add the parent ID's to each of the files.
See Gist Using Google Drive API to restore files removed from shared folders
for example of the last step.

Can Google Apps Script read the contents of a public folder?

If there's a folder on someone's Drive with sharing set so anyone with the link can view it, can a Google Apps Script see its contents? That is:
DocsList.getFolderByID(id).getFiles()
will show me the contents of a folder on my (or the user's) Drive. But is there a similar method for viewing files in a publicly shared folder? Thanks.
If by "public folder" you mean "a folder in another user's Google Drive that has been shared as public", then the answer is yes.
Nothing special - just use the ID of the folder as you would your own. There are some methods that you will not be able to use, for example Document.getOwner() will complain about permissions.