管理员如何访问特定域中所有用户的Google云端硬盘内容? [英] How can an Admin access the Google Drive contents of all the users in a particular domain?

查看:111
本文介绍了管理员如何访问特定域中所有用户的Google云端硬盘内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种工具,可以使用由管理员运行的Admin SDK自动将Google云端硬盘文档的所有权从一个用户转移到另一个用户.我使用数据传输API进行所有权转移.我想通过检查转让前后的Google云端硬盘文档的大小/数量来验证转让,对于该帐户,管理员帐户必须能够访问域中所有用户的Google云端硬盘内容.有没有办法做到这一点?还是有更好的方法来验证数据传输?

我尝试通过将密钥"设置为目标用户帐户来使用Drive API服务进行验证.到目前为止,我对Drive API的所有尝试都检索了管理员的Drive内容.

解决方案

文件.列表将检索用户的所有文件,在这种情况下,它将获取您自己的所有文件.只有当该用户同时也是您文件的所有者时,该查询才能起作用.

HTTP请求

GET https://www.googleapis.com/drive/v2/files

即使以管理员身份也无法直接访问用户文件.

要访问其他用户的文件,您需要以管理员身份模拟用户,然后代表他们执行操作.

这是通过使用具有域范围内授权的服务帐户来实现的. /p>

通常,当应用程序使用Google API来处理其自身的数据而不是用户的数据时,该应用程序将使用服务帐户.例如,使用Google Cloud Datastore进行数据持久化的应用程序将使用服务帐户来验证其对Google Cloud Datastore API的调用.

Google Apps域管理员还可以授予服务帐户整个域的权限,以代表该域中的用户访问用户数据.

这是一个相关的SO凭单,讨论最有效的用户文件传输过程: 解决方案

Files.list will retrieve all the user's files, in this case it will get all your own files. In order for that query to work would be only if that user is also owner one of your files.

HTTP request

GET https://www.googleapis.com/drive/v2/files

Even as an admin you cannot access users files directly.

To access other user's files, as an admin you need to impersonate the users and then perform actions in their behalf.

This is achieved by using a service account with domain wide delegation of authority.

Typically, an application uses a service account when the application uses Google APIs to work with its own data rather than a user's data. For example, an application that uses Google Cloud Datastore for data persistence would use a service account to authenticate its calls to the Google Cloud Datastore API.

Google Apps domain administrators can also grant service accounts domain-wide authority to access user data on behalf of users in the domain.

Here's a related SO ticket, discuss the most efficient process for transferring of users files: Most efficient process for transferring ownership of all of a user's files using the Google Drive API

这篇关于管理员如何访问特定域中所有用户的Google云端硬盘内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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