Issue with Google Drive API and group sharing

时光怂恿深爱的人放手 提交于 2019-12-12 07:40:40

问题


I'm facing an issue with an application I'm developing using Google Drive.

I have a Google group with some users inside, and I share a collection with this group. When I try to find this collection using Google Drive API (files().list()), as one of the users of this group, the collection shows up properly.

However, if I add another user to the group (either using API or Google CPanel), and try to find the collection using Google Drive API as this user, the collection doesn't show up, as if the user is not able to see it even though he is in a group allowed to see the collection.

If I manually open once the collection through my browser, then the collection is showing through Drive API.

Is this a normal behaviour ? In my use case I cannot expect from the users to open in their browser each and every collection shared with them in order for the application to work.

Any insight?


回答1:


I opened a Google Support case about this and apparently this behavior is "expected". Here are some excerpts from my exchange with "Angel" from Google Enterprise Support (typos corrected and emphasis mine):

After reviewing the stackoverflow question, we need to clarify to you that the behavior shown is expected. When adding a user to a group, this group must be added again for any files that it has been shared with.

and

All information previously provided is from internal documentation for Drive UI; however the functionality is the same for SDK, therefore, group must be deleted and added back to the list of users that have access to files/folders after adding a new member.

So, there you have it. Not sure if @Burcu will ever come back and confirm.

<EDIT> It gets worse. According to this Google document, groups with more than 200 members will never see files shared with them, even if you delete and add the group back. </EDIT>

Useless post-answer rant follows:

This behavior, even if it is "expected" by Google, does not seem to be properly documented, and it is neither expected nor usable by clients of the service. How are we supposed to know when a user has been added to a group that has items shared with it? Are we supposed to constantly monitor group memberships as well as maintain a list of all things shared with the group and then *re*share them with the group when the membership changes, just to get consistent behavior? It makes me wonder why Google doesn't already do this on the back end; it can't be that expensive to register a list of callbacks with a group that are triggered upon membership changes. And the requirement that we actually unshare is even more bizarre, since it necessitates a short period of time during which nobody in the group can access the resource.



来源:https://stackoverflow.com/questions/16903820/issue-with-google-drive-api-and-group-sharing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!