Block downloads from Google Drive Api - google-drive-api

Currently I am working on a project where it's next feature it's to block downloads on demand for a specific file/folder via API. The problem is that, I am not able to find that functionality in the docs.
There are Permissions to change, but neither of the options are to block downloads. I also discovered an attribute called capabilities.CanDownload, but unfortunately is none writable attr. I kept searching but I found nothing.
I was wondering is someone had the same issue and resolved it.
Thanks

From the user interface you can see that download permissions can be disabled for readers and commenters:
To achieve the same with the Drive API, you need to use the method Files:update and set the property copyRequiresWriterPermission to true

Related

What is the internal file format of a .glink file?

I would like to add URL links into a web-based Google Drive folder. Searching online, it appears that this was once possible with files that ended in a .glink extension. I'm looking for documentation on the file format so that I can create them programmatically.
[EDIT] Why do I want to create .glink files? Because I want links (bookmarks, URLs) to be able to appear in my Google Drive web page and to be able to click on them an go to the page. Microsoft OneDrive supports this functionality.
GLINKS Files
The URL link file feature was available due to a workaround with Back Up and Sync before being deprecated with Drive for Desktop. The .glink seems to be patched and no longer available as it was also part of a third party tool no longer available. It seems it now only saves them as .URL and automatically gives it the icon for Google Docs, as it would take it as a simple file with text.
Checking the .url type file of Windows, when uploading to Drive it does not update as it should, even utilizing Drive for Desktop (as an alternative to sync data like back up and sync) the outcome is the one suggested above.
This is the main reason why there is no longer any documentation about the matter, due to this one not being an official feature and being also fully deleted, it can be confirm by the file type available when creating files with the Drive API:
https://developers.google.com/drive/api/guides/ref-export-formats
I would suggest to request a feature to allow this or to provide a new way to store URL links as before or report it to review if possible any references on how it used to work by submitting a feature request or checking the issue tracker about the matter:
https://issuetracker.google.com/issues/new?component=191650&template=824106
You can also add the details of the previous threads or discussions about the GLINKS.

How to safely remove multi linked documents and folders from one location in google drive?

We use the multi-linking of folders and documents in Google drive to share live updates with our whole team. This is very useful as each person gets access to the doc and any updates made are received in real-time.
The trouble we have is that if anyone decides to remove the multi-linked item from their home directory using the "remove" option, the content is trashed for everyone. This causes loss of data and info and is not acceptable. We do have the option of checking the location of the multi-linked item and removing it from that particular location alone. But not everyone follows this.
Is there any way we can do the settings such that the "remove" option works only on the current location for the multi-linked item? All ideas are welcome. Can we use Google App Script for this?
There is no workaround for this as of now.
However, you can file a Feature Request for this.
There is no way for you to alter how the google Drive web application works. Remove will remove it forever one.

Google Drive permission "add but not edit"

Is there any way to do this?
I want a shared folder, which will be used for resources for a project, I want to allow my developer to add new files which I will then review and use, but not to edit existing ones as then it'll bypass my review.
This is for security reasons.
Any ideas? If a solution exists for OneDrive I'd also accept it.
No, that is currently not available. You can only give them edit permission, which includes add and edit.
The best way to achieve this is to script moving any added items into a private or view-only folder.
You only have a few permissions roles that you can set.
owner
writer
commenter
reader
So, there's no quick way to do that. What I can suggest is for you to detect changes on the folder (considered as file with the MIME type application/vnd.google-apps.folder) in which the file will be added, and then change the permission of that file to reader.
Hopefully the suggestion would be sufficient for your use case.
Happy coding!

Google Drive “Share” dialog not showing for "writer"

We've incorporated Google Drive “Share” dialog into our web application which creates its own files, and it works perfectly thanks to the answer to another question, but only for document owner.
Even though "writers" can easily share documents from Google Drive, that seems to be not possible externally, i.e. in our app.
This is the code which works for "owners" but fails for "writers":
var s = new gapi.drive.share.ShareClient(appId);
s.setItemIds(fileId);
s.showSettingsDialog();
Curiously, the error in JS console is the same as one can see when the script is launched from a wrong URL:
Refused to display 'https://drive.google.com/share?id=0B....' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'
We haven't found anything related to possibility to share docs by various user roles in the documentation, so we wonder if that's a bug or undocumented restriction. Any ideas are welcome.
UPDATE
The issue seems to have gone - it looks like Google have changed something their end.
Your app should be checking the value of the writersCanShare attribute. If it's false, only owners can modify the file ACLs.

Moving a file into a Google Drive folder without changing its ACL

In Google Drive, when puting a file into a folder, the ACLs of the folder are added to the ACLs of the file.
Is there a way to avoid that? In my use case, a lot of user have "Can View" access on the folder, but only a subset of those will ultimately allowed to view that file. Even if we quickly follow with an ACL update request, there will be a short amount of time during which the visibility of the file is too broad for my use case.
Note that a solution involving having a short period of time during which the access is more limited that what it will ultimately be would be acceptable. Also, I am ready to use either Drive API or Document List API.
This might help
I was so happy when I found it! Unfortunately, it still cannot override file settings, in the case of a document owned by someone else than the containing folder's creator.