3

私は Google アカウントの「ドメイン管理者」であり、次のことを希望しています: ドメイン内のすべてのユーザーを取得し、「各」ユーザーに対して、別のユーザーに全員のファイルの読み取りアクセス権を付与します。各ユーザーを取得できますが、現在、各ユーザーのドキュメントを取得する方法がわかりません。

#!/usr/bin/python
import gdata.docs
import gdata.docs.service
from gdata.apps import client

userNameAtGmailCom = 'domainAdmin@someplace.com'
password           = 'mypassword'
personToShareWith  = "someGuy@gmail.com"
domain             = 'someplace.com'

def login(userNameAtGmailCom, password, personToShareWith, domain):
    client = gdata.apps.client.AppsClient(domain=domain)
    client.ssl = True
    client.ClientLogin(email=userNameAtGmailCom, password=password, source='apps')
    all_users = client.RetrieveAllUsers()
    for user in all_users.entry:
                user_name = user.login.user_name
                print user_name
                password = user.login.password
                print password
                clientDocs = gdata.docs.service.DocsService()
#password always returns 'none' 
#therefore I've commented out the 'bad authentication'
#that would happen if the lines below ran
                #clientDocs.ClientLogin(user_name, password)
                #documents_feed = clientDocs.GetDocumentListFeed()
                #for document_entry in documents_feed.entry:
                #print document_entry.title.text
                #scope = gdata.docs.Scope(value=personToShareWith, type='user')
                #role = gdata.docs.Role(value='reader')
                #acl_entry = gdata.docs.DocumentListAclEntry(scope=scope, role=role)
                #created_acl_entry = client.Post(acl_entry, document_entry.GetAclLink().href, converter=gdata.docs.DocumentListAclEntryFromString)

login(userNameAtGmailCom, password, personToShareWith, domain)
4

1 に答える 1

3

Google Drive API を使用し、サービス アカウントを使用して、Google Apps ドメイン全体の権限の委任を実行する必要があります。

https://developers.google.com/drive/delegation

于 2012-12-05T21:20:32.043 に答える