谷歌云端硬盘API - 添加和更新权限 [英] Google Drive API - Adding and Updating Permissions

查看:494
本文介绍了谷歌云端硬盘API - 添加和更新权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Andr​​oid应用程序的工作文件共享在谷歌驱动器。下面是这种情况......用户A股与用户B文件,给他/她的作家的角色。后来,健忘用户A,再次股与用户B在同一个文件,给他/她的读者的角色这个时候。我的问题是,这将覆盖第一个权限?还是应该在应用程序处理现有文件的权限检查?

I'm working on file sharing on Google Drive in my android app. Here is the scenario... User A shares a file with User B, gives him/her the "writer" role. Later, forgetful User A, again, shares the same file with User B, giving him/her the "reader" role this time. My question is, will this override the first permission? or should the app handle checking of existing file permissions?

推荐答案

您可以使用的 drive.permissions.update 更新角色 A 许可的财产,前提是你必须 FILEID permissionId 。在角色属性将被覆盖。但是,如果你发现有一个 additionalRoles [] 属性,将让你二次角色添加到提供给用户这个权限。现在,只有评议是允许的。也许在未来,更多的角色将在该属性添加。

You can use drive.permissions.update to update role property of a permission, provided that you have fileId and permissionId. The role property will be overridden. But if you notice, there is a additionalRoles[] property that will allow you to add secondary roles to that permission given to a user. Right now, only commenter is allowed. Maybe in the future, more roles will be added in that property.

您可以自己使用谷歌API浏览器确认:

You can confirm by yourself using Google API Explorer:


  1. 首先,发送 drive.files.list 请求来获取 FILEID 共享的
    文件。

  2. 发送 drive.permissions.list 与要求 FILEID 来获得
    permissionId 用户(它是在该效应初探 ID )的。

  3. FILEID permissionId ,现在你可以使用
    drive.permissions.update 来改变用户通过发送作用
    在体内角色属性的请求。

  1. First, send drive.files.list request to get fileId of a shared file.
  2. Send drive.permissions.list request with the fileId to get permissionId of a user (it is the id in the reponse).
  3. With fileId and permissionId, now you can use drive.permissions.update to change the role of that user by send the request with role property in the body.

这篇关于谷歌云端硬盘API - 添加和更新权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆