Google Realtime API - share settings on shortcut file - google-drive-api

This is a follow up to Google Realtime API - what is the role of a shortcut file in google drive?
What is the effect of share settings on a shortcut file? Does a user need to share this shortcut file with other collaborators?
In my case, my web application already contains share settings between users. These are my own share setting that I store in my database. They are currently sharing between each other but have to edit a file one person at a time. Ideally I would like to just use the settings from my application to seamlessly make it so that they can collaborate at the same time, without having them to once again give edit permissions.

The share settings control who has access to read or write to a realtime document, just like for any other Drive file.
They can be set programmatically via the Drive API, or you can allow users to update settings via a common sharing dialog. See https://developers.google.com/drive/manage-sharing
If you have an existing setup, you could programmatically transfer the share settings to the realtime shortcut files as one-off transition step. We don't generally recommend trying to keep them in sync, as it can be a bit tricky, but its possible.

Related

Directory sandboxed access for Google Drive / Dropbox API / RemoteStorage apps?

Is there a way to get sandboxed, user-selected directory access on any major file service without first getting read level access to their entire filesystem?
There's a lot of talk about "unhosted" static webapps that allow users to access their data from a 3rd party file service (Google Drive, Dropbox, their own server, etc.). The most notable effort I've found so far is remoteStorage.io, but there doesn't seem to be a way with any major provider to let the user select a directory and then use that as a sandbox without breaking their trust (i.e. getting read access to all their files first).
From the user's perspective, the webapp shouldn't have access to anything else on the remote file storage except the one folder the user grants it access to (for example, I might grant a text editor access to my FunnyJokes folder).
The current work around seems to be having the webapp force a specific folder name ahead of time ("this app wants access to /appname_notes"), but that rules out letting the user point it to where they may already have their notes.
Does anyone know of a nice way to do this with Google Drive, Dropbox, or the like?
The user experience that makes the most sense to me is something like...
User opens an unhosted webapp (for example, a basic text editor TextyApp). They click a button to connect with their data.
3rd party auth page appears (for example, Google Drive) and it says "The app TextyApp has requested read/write access to your files. Please select a directory to use."
Confirmation screen: "Grant read/write access to folder FunnyJokes for TextyApp?"
The page redirects back to the webapp with sandboxed accessed to the user-specified folder and the files within it.
This seems like how remote file storage should work, but I haven't found a way to do it yet. Any thoughts/suggestions would be great!
Cheers,
Adam
Edit: To clarify, I'm not talking about storing hidden "application data", but instead letting the user specify a particular directory to sandbox for use with a webapp that they may not want to give broader access to.
The Dropbox Apps API provides the ability to restrict any app using your API key to a single directory of your Dropbox account. So users could create an API key with access to a specific directory and then plug that into your app. However, that's not a user-friendly workflow.
I think the Dropbox Drop-Ins Chooser/Saver API might be close to what you want. The user is presented with a Dropbox file selection popup, and your app only gets access to the specific file(s) that the user selects.
With remoteStorage, sandboxed directory access is currently the default way for apps to request (and users to grant) access to the storage. However, users cannot manually select or enter custom directories during the connect phase.

Google Drive Permissions

I work for an un-launched startup that handles a large amount of user media. We are looking to integrate Google Drive as a way for a user to store that media.
Is it possible to have read/write access to a user's Google Drive, after obtaining their permission via OAUTH2? More specifically the ability to create folders on their drive and access them for read/write scenarios.
We would also need to be able to generate direct links to their photos, videos, etc.
We've successfully integrated with Dropbox in this manner and would like to offer Google Drive as an alternative. Are these scenarios possible with Google Drive?
Yes, this is absolutely possible.
You will want to read about our Auth Scopes and determine what the minimal set of scopes are that you need to operate. As an example, drive.file scope will enable you to create files & folders, read them, as well as read/write any existing files that a user explicitly opens with your application.
The 'explicitly open' part can be handled in 2 ways. You can register an 'Open' action for your app in the Drive UI for certain file types and you can use our 'File Picker' widget in your app to enable the user to select which files to open/grant access. You can read about opening files in our docs

Change Google Drive settings in the Admin Console of Google Appsor not

Google Apps admin console has a section dedicated to Google Drive settings for all the domain. Through these you can decide if users can share or not documents outside the domain, etc. Unfortunately you cannot apply the settings to specific sub-orgs but to all the domain. However Flash Panel allows you do to this and I'm wondering which API they're using to accomplish it. I went through Google Apps Admin SDK documentation but I couldn't find anything to control or change Drive settings in the Admin console via API.
Have you got any clues about it?
Thanks a lot!
When you change these settings in the CPanel, as you noted, the setting is strictly enforced for all users in the Google Apps instance. The user no longer even has the ability to share Drive files outside of the domain.
There are no API settings that correspond to the CPanel settings. The way FlashPanel appears to be enforcing the settings is by setting up "rules" (this OU can't share with people outside the domain except for this external domain). Then FlashPanel monitors user file sharing under that OU, looks for violations and can either automatically undo the share or send a notification of the violation.
Thus FlashPanel is not strictly enforcing the sharing policies like the CPanel setting can. The user still has the option to share externally and for some period of time, the file is actually shared externally. FlashPanel simply has the ability to notifiy and or rectify the situation afterwards.

If I use the Google Drive SDK in my app is it possible to hide the saved data from the user?

I want to use the Google drive sdk to save data from my app in the user's own Google drive account. This will mean that the developers of the app (i.e. me) won't have access to sensitive data that the user is storing.
I have found some docs about how to do this (the app will be a Google app engine app) but I was wondering if I can lock this data or hide it completely so that a user can't go in and edit the data and possibly cause problems.
I know that Android apps that use Google drive do not leave any visible files that I can see when I go to my drive account.
Thanks
When creating the file, set the hidden label to True. This will hide the file from most user views. Note that it doesn't completely prevent the user from finding and modifying the file if they own it.
If you need the file to be uneditable by the owner, your app will need to own it and only grant the user view access.
In Google Play Services 4.3, they added an "Application Folder." This is designed to allow applications to store data in a user's drive without allowing them to modify this data. It's available for android and web, don't see it listed for iOS.

Allowing a third party website to save to my drive (and with no sharing permission)

We're working on an app to sell our music and was wondering if Google Drive can be used as an online storage solution.
The user would complete the transaction on our site, and then authorize us to save the file (or multiple files) to their Google Drive.
The appeal to us is to solve downloading problems via the browser. I believe the Google Drive api returns a successful response when the delivery is complete. If incomplete, we would then either resend or update.
One other requirement is whether we can set permissions to not allow sharing after save (and for that setting to be permanent).
You can do everything you want. The last part about not allowing users to reshare, you can do this if you still own the file, but cannot do it if you have made the user own the file. I am not sure you could ever achieve that - a user can always download a file and share it themselves, whether you are using Drive or your own custom system.