Google APPs managed "unlimited" account storage quota for service account

apropos2341

I have a Google account as a student. This account is managed by my university and recently the university informed us that students' accounts have now "unlimited" storage for Drive etc.

To perform backups with this, I created a few service accounts in Google APIs console ([email protected]). But it turns out that those accounts' storage is limited to 15GB, that is, when trying to upload files to one of service accounts that already has ~15GB in it, I get an error "the client is exceeded his storage quota".

I asked the university admins, they don't know how to help and even don't see the service account' email ([email protected]) in the list of managed accounts.

So the question is what should be done (by me or by university admins) to remove (or increase) the storage quota of my service accounts when those were open with the "unlimited" student account.

Update: trying @DaImTo suggestion:

So I created a folder in my Drive web interface and shared it with my service account. Then, with service account, I uploaded a file to that folder (using PyDrive library):

file1 = drive.CreateFile({'title': 'test2', 'parents': [{"kind": "drive#fileLink", "id": shared_folder_id}]})
file1.SetContentString('some text')
file1.Upload()
print 'File ID: %s' % file1['id']
permissions = file1.auth.service.permissions().list(fileId=file1['id']).execute()
print "permissions:", permissions

Output:

File ID: XXX
permissions: {u'items': [{u'kind': u'drive#permission', u'name': u'[email protected]', u'domain': u'developer.gserviceaccount.com', u'etag': u'"XXX"', u'emailAddress': u'[email protected]', u'role': u'owner', u'type': u'user', u'id': u'XXX', u'selfLink': u'https://www.googleapis.com/drive/v2/files/XXX/permissions/XXX'},
{u'kind': u'drive#permission', u'name': u'<my name>', u'domain': u'<my school domain>', u'etag': u'"XXX"', u'emailAddress': u'<my name>@<my school domain>', u'role': u'writer', u'type': u'user', u'id': u'XXX', u'selfLink': u'https://www.googleapis.com/drive/v2/files/XXX/permissions/XXX'}], u'kind': u'drive#permissionList', u'etag': u'"XXX"', u'selfLink': u'https://www.googleapis.com/drive/v2/files/XXX/permissions?alt=json'}

So the uploaded file automatically has two permissions: 1. Service account is "owner" 2. My main account is "writer"

Indeed, I can see the file in web interface, edit it , delete etc. But, since the service account is the owner, the file is accounted in service account storage quota, so this doesn't solve my problem, i.e. I still cannot use more than 15GB with my backup application.

I tried to transfer the ownership to my main account:

file1 = drive.CreateFile({'id': file_id})
permissions = file1.auth.service.permissions().list(fileId=file1['id']).execute()
myperm_id = permissions['items'][1]['id'] # this is the second permission, i.e. of my main account
myperm = file1.auth.service.permissions().get(fileId=file1['id'], permissionId=myperm_id).execute()
myperm['role'] = 'owner'
file1.auth.service.permissions().update(fileId=file1['id'], permissionId=myperm['id'], body=myperm).execute()

...and got an error:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/XXX/permissions/XXX?alt=json returned "Insufficient permissions for this file">

I tried to append transferOwnership='True':

file1.auth.service.permissions().update(fileId=file1['id'], permissionId=myperm['id'], body=myperm, transferOwnership='True').execute()

got the same error. I'm stuck here.

Btw, in Google help Transfer file ownership they say "If you're a Google Apps user, you can't transfer ownership to someone else who is outside of your domain."

apropos2341

It seems that it's impossible to transfer the ownership of the files uploaded by service account to the main account.

Finally I abandoned the service account approach and followed this approach to run my app as my regular user.

Once the steps described there were accomplished, I create the drive service like that:

import httplib2
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive

gauth = GoogleAuth()
gauth.LoadCredentialsFile("GoogleDriveCredentials.txt")
if gauth.credentials is None:
    gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
    print "Google Drive Token Expired, Refreshing"
    gauth.Refresh()
else:
    gauth.Authorize()
gauth.SaveCredentialsFile("GoogleDriveCredentials.txt")
drive = GoogleDrive(gauth) 

Where GoogleDriveCredentials.txt is of the form:

{"_module": "oauth2client.client", "token_expiry": "XXX", "access_token": "XXX", "token_uri": "https://accounts.google.com/o/oauth2/token", "invalid": false, "token_response": {"access_token": "XXX", "token_type": "Bearer", "expires_in": 3600}, "client_id": "XXX.apps.googleusercontent.com", "id_token": null, "client_secret": "XXX", "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "_class": "OAuth2Credentials", "refresh_token": "XXX", "user_agent": null}

Now the uploaded files' owner is "me" in web interface and they are accounted in my main account's storage quota, so my goal is reached.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Downloading a google drive file without sharing it with service account

분류에서Dev

Google Analytics - Access custom segments through Service Account

분류에서Dev

Event for Chrome Google account logout or Google account user switch

분류에서Dev

Can server-side access to Google Cloud Firestore be restricted for a service account to specific collections?

분류에서Dev

Permissions required for an account to use a Windows Service

분류에서Dev

Cannot log into Google Drive sync application or Google Sync after associating GMail account to Google+ account

분류에서Dev

Copy VHD from azure disk to azure storage account

분류에서Dev

Failing to authorize connection to own GAE endpoints API with service account

분류에서Dev

How to access domain users' calendar using service account in .net?

분류에서Dev

How to access domain users' calendar using service account in .net?

분류에서Dev

AdMob account migration and AdSense account

분류에서Dev

How can I change the default google account in google chrome?

분류에서Dev

열려있는 파일이 너무 많음 : Google의 Natural Language API를 호출 할 때 '/home/USER/PATH/SERVICE_ACCOUNT.json'

분류에서Dev

Syncing Data between multiple android devices with 1 google account

분류에서Dev

Android: how to get network coordinates witout signining up in google account

분류에서Dev

Windows 10 Settings app crashes when trying to remove account used by other apps

분류에서Dev

Windows 8.1 Admin account is logging in as a user account

분류에서Dev

How change to administrator account from standard account

분류에서Dev

Use Wget to download a file from my Ubuntu One Account/ Online Storage

분류에서Dev

Delete the Twitter Account Programmatically

분류에서Dev

Not login to paypal sandbox account

분류에서Dev

Not taking into account condition

분류에서Dev

Log in and check the account type

분류에서Dev

Transferring project to another account

분류에서Dev

Google Play Billing : how to simulate 'Account Hold' status (in debug/sandbox mode)

분류에서Dev

Migrating custom Tabs from Demo account to production account

분류에서Dev

How to convert regular windows 10 account to an active directory account?

분류에서Dev

/ account / login /에서 NoReverseMatch

분류에서Dev

Stripe No such customer (Express Connected Account)

Related 관련 기사

  1. 1

    Downloading a google drive file without sharing it with service account

  2. 2

    Google Analytics - Access custom segments through Service Account

  3. 3

    Event for Chrome Google account logout or Google account user switch

  4. 4

    Can server-side access to Google Cloud Firestore be restricted for a service account to specific collections?

  5. 5

    Permissions required for an account to use a Windows Service

  6. 6

    Cannot log into Google Drive sync application or Google Sync after associating GMail account to Google+ account

  7. 7

    Copy VHD from azure disk to azure storage account

  8. 8

    Failing to authorize connection to own GAE endpoints API with service account

  9. 9

    How to access domain users' calendar using service account in .net?

  10. 10

    How to access domain users' calendar using service account in .net?

  11. 11

    AdMob account migration and AdSense account

  12. 12

    How can I change the default google account in google chrome?

  13. 13

    열려있는 파일이 너무 많음 : Google의 Natural Language API를 호출 할 때 '/home/USER/PATH/SERVICE_ACCOUNT.json'

  14. 14

    Syncing Data between multiple android devices with 1 google account

  15. 15

    Android: how to get network coordinates witout signining up in google account

  16. 16

    Windows 10 Settings app crashes when trying to remove account used by other apps

  17. 17

    Windows 8.1 Admin account is logging in as a user account

  18. 18

    How change to administrator account from standard account

  19. 19

    Use Wget to download a file from my Ubuntu One Account/ Online Storage

  20. 20

    Delete the Twitter Account Programmatically

  21. 21

    Not login to paypal sandbox account

  22. 22

    Not taking into account condition

  23. 23

    Log in and check the account type

  24. 24

    Transferring project to another account

  25. 25

    Google Play Billing : how to simulate 'Account Hold' status (in debug/sandbox mode)

  26. 26

    Migrating custom Tabs from Demo account to production account

  27. 27

    How to convert regular windows 10 account to an active directory account?

  28. 28

    / account / login /에서 NoReverseMatch

  29. 29

    Stripe No such customer (Express Connected Account)

뜨겁다태그

보관