User with edit privileges made files I own not viewable by me - google-apps-script

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

Related

Lifetime of a Google Apps script with no owner?

I have a Google Apps script that belonged to a former colleague. They have been offboarded and the script currently has No Owner. I am curious how long this GScript will exist without an owner assigned.
The user has been deleted since May and we have a backup.
Based on the fact that you can restore a user within the first 20 days of being deleted and a file can be restored within the first 25 days of being deleted (if the user still exist) I would say it will remain available 20 days. After that it will be permanently deleted and cannot be restored or transfer, I would suggest to make a copy of the file.
You can check these G Suite Administrator Help Center Articles to have more details about how Google manage deleted users and files.
Restore a recently deleted user
Restore deleted files or shared drives
Restore a deleted user's Drive files
UPDATE:
After checking the image well, I can see that the file is within a Shared Drive or "Team Drive" if that is the case according to "Store & share files with shared drives".
Members of a shared drive share ownership of any files and folders.
If someone leaves the shared drive, any files they added will stay.
You can still share files with a link or invite.
That means if the user is deleted (leaves the share drive) the file added will stay, so it will be forever. And the Shared Drive cannot be deleted if contains files, if someone wants to delete the Shared Drive they must delete the files first.
I just wanted to follow this up as I found a bug on Google Issue Tracker which shows that if a user is deleted while they own some scripts that are bound to Drive files, upon user deletion even if the Drive files are transferred to another user on the domain the owner doesn't change and the scripts can become inaccessable. Make sure that in the future all scripts are copied or saved in a shared Drive so that they can be accessed on user account deletion/migration.

Creating a google drive folder on customers account

I am working on an application which requires the automatic creation of a folder on customer's Google Drive accounts as opposed to them creating this themselves.
I will have their permission to do so and won't have access to this folder. Ideally this folder would be encrypted but they could do this afterwards themselves.
Is it possible? And if it, how can I achieve that?
It can be done using the REST API. See the section called Creating a folder.
https://developers.google.com/drive/api/v3/folder

Google Drive API - Override Owner in Shared Folder

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.

Prevent deletion of files in Google Drive

I am trying to prevent deletion of all files uploaded to specific folder in Google drive. The idea is several people will be able to upload files to this drive, but they should never be able to delete it.
I thought of putting a Google apps script to achieve this, like letting the script run every x interval and getTrashedFiles and set isTrashed to false. But what if the user is able to delete it from trash too?
Is there a foolproof way?
Or is Google Drive not the right answer at all?
Any other service can help me which is simple for people uploading the files?
TIA
its possible but the way you are doing it isnt practical or tamperproof.
instead write a little apps script webapp that allows uploading files to the given folder where you are owner and only writter.
publish it to run as you with permissions to anyone (or your domain). they will be able to add files and view but not change or remove them (and you will be the owner of all uploaded files).
to support uploading files already in drive (move them to the folder) is also possible but with more code.

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.