Google Selection Tool API - displaying files that are eligible for sharing by the user

My current project involves using the Google Picker to select a specific file from Drive, retrieve its id, and then share it with other accounts through the Drive API. The challenge I am facing is that I can only:

  • View all files the user has access to (even if they have read-only permissions),
  • View files where the user is listed as the owner.

The first option could potentially lead to sharing issues, while the second option may hide files that are actually shareable by users (often times editors also have permission to share).

Does anyone know of a method to display only shareable files in the Google Picker?

Thank you, Kacper

Answer №1

It seems that the Google Picker API does not offer a direct way to check for editor status, but you may find assistance from the Drive API.

After reviewing the Google Picker documentation, it appears that the picker uses PickerBuilder() with View objects to control file visibility. The DocsView subclass includes a setOwnedByMe() method to filter files owned by you, though it does not account for editor permissions.

Although View offers a setQuery() method that might seem useful for adding search queries, testing revealed that it utilizes Drive UI's advanced search syntax, which does not include an option to check for editor status. This method simply populates the existing search field in the picker.

An alternative approach involves using the selected file IDs from the picker's Response.DOCUMENTS, validating user editing permissions via files.get, and providing warnings for inaccessible files. Additionally, explore files.list for searching guidelines, including querying editor status with '[email protected]' in writers.

If exclusively displaying files based on editor access is crucial, consider developing an app solely utilizing the Drive API instead of relying on Google Picker. Since PickerBuilder() forms a dynamic connection to Drive, integrating files.list data into it poses challenges.

Answer №2

I'm in the same boat as you with this scenario. Unfortunately, I haven't been able to find any pre-existing configuration on Google Picker that supports it.

Here's the workaround I came up with:

  1. Retrieve the selected document
  2. Make a call to drive.permissions.list, iterate through and apply a few conditions to check
  • Type:user and email:<the user email, you need email> and role:editor OR
  • Type:anyone and role:editor

For more information, check out: https://developers.google.com/drive/api/v3/reference/permissions#resource

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A step-by-step guide on installing an npm package from the GitHub registry

Uncertain of the process for installing a package from the GitHub registry that relies on dependencies from the public npm registry. Attempted solution: npm_config_registry=https://npm.pkg.github.com npx @octopol/development This method failed due to som ...

The Mounted method in Vue.js does not seem to be firing when I utilize a computed method to filter components

I have a requirement to showcase an image obtained from an external API. The image fetching logic is implemented in the mounted hook of my ProductCard.vue component. <template> <q-card class="my-card column text-center no-border-radius& ...

What is the most effective way to access content from a webpage that is rendered

Is there a reliable way to download from links on a JavaScript rendered webpage using Python as the preferred language? I have attempted to use the Selenium Python bindings on a headless server, but it has proven to be slow, error-prone, and unable to acc ...

What are the reasons for encountering errors when using concat to merge two arrays of objects?

Hello, I am encountering an Error The error message says "concat is not a function" Here is what I am attempting searchResults:any; // inside class export results:any this.candidateSearch.postSearch(this.searchedInput,"candidateSearch"). ...

Accessing User Session with NextAuth in Application Router API Route

Utilizing NextAuth in conjunction with Next.js's App Router, I have established an API route within my /app/api directory. Despite my efforts, I am encountering difficulties retrieving the session associated with the incoming request. Below is the sn ...

Issue with Bcrypt comparison resulting in constant false output

Attempting to implement password verification using bcryptjs, const bcrypt = require('bcryptjs'); login(post){ this.uid = post.uid; this.pin = post.pin; this.getUser(this.uid); if(this.checkUser != undefined ...

These JS and Perl scripts may encrypt the same data, but they generate different results. Isn't it expected for them to produce identical output?

Two different programs, one in Javascript and the other in Perl, were designed to accomplish the same task with identical input data. Nevertheless, the output generated by these programs varied. The issue stemmed from using JavaScript on the client side to ...

What is the best way to automatically restart a Node.js application using TypeScript and NodeJS?

Currently, I am in the process of setting up a new project using nodejs, express, typescript, and babel. My approach involves utilizing babel to transpile typescript code quickly and etsc for types checking. During coding, I prefer the application to appl ...

Repetitive use of multiple submit buttons in AngularJS

i'm currently working with AngularJS Currently facing this issue: view screenshot I have utilized the following HTML code to display submit button for two different types of forms. One for TEXT Form and one for ENUM Form: <div ng-controller="g ...

Is there a way to change the image source only when the input is in focus?

Issue Statement: I have successfully implemented a search bar with three inputs for name, date of birth, and social security number. However, I am facing a design challenge when it comes to enhancing the appearance on input focus. https://i.sstatic.net/ly ...

What is the method for stopping a slide in this script?

Welcome everyone! Check out this piece of code I have: <script type="text/javascript" > $(function(){ var time = 10000;//milliseconds var index = 0; var container = $("#containerr"); var child ...

What could be causing the issue with my custom AlloyEditor UI extension?

After following the instructions in this guide to integrate alloyeditor as a WYSIWYG editor into Contentful, I successfully added the extension to my contentful staging space. However, despite copying the html page from the github repository and includin ...

Searching an array in Javascript to dynamically create a table based on another array

I have two arrays in JavaScript that I need to combine into a table. First Array: [ { route: 'x1' }, { route: 'x2' }, { route: 'x3' }, { route: 'x4' }, { route: 'x5' } ] Second Array: [ { pattern: &ap ...

How to apply class binding within a v-for loop in Vue.js

When using Vuejs3, I am currently iterating through an array of objects: <div v-for="ligne in lignes" :key="ligne.id" :class="{ 'border-b-2':isSelected }" :id="`ligne_${ligne.id}`" > ...

Can I initiate an AJAX call from a different JSP page?

My scenario involves a JSP page that opens another JSP in a new tab. In the second JSP, I upload a file to the server, as I have certain important operations to perform there. However, I also need to include a link to this uploaded file in the first JSP ...

Display the previous 12 months in reverse chronological order with Angular 6 using a select dropdown option

I aim to dynamically display the last 12 months with the year in a select option. For example: If the current month is March and the year is 2021, the first option should show as March-2021 followed by the previous 12 months in reverse order. If the cur ...

The combination of Vue.js and SVG modules resulting in misaligned nodes

Imagine having two vue components: parentComponent.vue <template> <svg> <child-component v-for="i in ['a', 'b']" :key="i"/> </svg> </template> ... childComponent.vue <template> <g> ...

arrange a collection within an array containing keys as strings

I am facing an issue with sorting an array of objects. I need to sort the 'list' by 'score' in descending order. var list =[{ '440684023463804938': { score: 6, bonuscount: 2 }, '533932209300832266': { score: 20, b ...

React application experiencing Unhandled Promise Rejection (RangeError): Call stack size limit reached

For my first form in ReactJS, I used a functional app and successfully implemented basic validations. I've also created a function to handle form submission to the backend. But upon clicking submit, I encountered the following error: enter image desc ...

Error when redirecting in Express due to invalid integer input syntax

After executing a PUT query in Postgres through Express, I encountered the following error message: Error: invalid input syntax for integer: "all-calls" This issue seems to be related to the line of code within the router.put function that says response. ...