问题描述
我在我的Android应用程序的工作文件共享在谷歌驱动器。下面是这种情况......用户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?
推荐答案
您可以使用的更新角色
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.
您可以自己使用确认:
You can confirm by yourself using Google API Explorer:
- 首先,发送
drive.files.list
请求来获取FILEID
共享的
文件。 - 发送
drive.permissions.list
与要求FILEID
来获得permissionId
用户(它是在该效应初探ID
)的。 - 在
FILEID
和permissionId
,现在你可以使用drive.permissions.update
来改变用户通过发送作用
在体内角色
属性的请求。
- First, send
drive.files.list
request to getfileId
of a sharedfile. - Send
drive.permissions.list
request with thefileId
to getpermissionId
of a user (it is theid
in the reponse). - With
fileId
andpermissionId
, now you can usedrive.permissions.update
to change the role of that user by sendthe request withrole
property in the body.
这篇关于谷歌云端硬盘API - 添加和更新权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!