使用服务帐户确定 Google Drive 文档的所有者 [英] Determine the owner of a Google Drive document with a service account

查看:67
本文介绍了使用服务帐户确定 Google Drive 文档的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来检索 Google Apps 域上的云端硬盘文档的内容,但只知道文档 ID.

I am looking for a way to retrieve the content of a Drive document on a Google Apps domain knowing nothing but the document ID.

我有一个服务帐户,该帐户可以在 Google Apps 域中获得任何所需范围的授权,并且可以模拟任何用户.该文档可由域中的任何用户拥有,不一定与特定帐户共享.

I have a Service Account that can be authorized on the Google Apps domain for any required scope and can impersonate any user. The document can be owned by any user of the domain and is not necessarily shared with a specific account.

有没有比一个一个地检查所有用户,检查他们是否有权访问所述文档,如果是,则检索文档内容更有效的方法?最坏的情况是,我必须通过所有用户才能打开文档,这可能非常繁重.

Is there any way more efficient than going through all the users one by one, checking if they have access to the said document, and if yes retrieve the document's content? Worst case scenario, I will have to go through all the users before being able to open the document, which can be quite heavy.

如果我有办法快速确定文档的所有者,我就可以冒充他并轻松获取内容.

If I had a way to quickly determine the owner of a document, I could impersonate him and get the content easily.

非常感谢,

推荐答案

出于安全原因,无权访问文档的用户将无法看到有关文档的任何详细信息,包括所有者.因此,您唯一的选择是遍历每个用户.

For security reasons, users who have no access to the document won't be able to see any details about the document including owner. Thus your only option is to loop over each and every user.

如果您有 Google Apps Unlimited 或 Google Apps for EDU,您可以使用 Reports API 更好地了解您域中的哪些用户可能查看或编辑过文档,从而为您提供有关谁有权访问的线索.为此,您需要列出云端硬盘活动并在过滤器属性中包含 doc_id.

If you have Google Apps Unlimited or Google Apps for EDU, you may be able to use the Reports API to get a better idea of which users in your domain may have viewed or edited the document giving you a clue about who has access. To do this, you would list the Drive activities and include the doc_id in the filter attribute.

这篇关于使用服务帐户确定 Google Drive 文档的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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