Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start-GSDriveFileUpload only writes to domain superadmin drive #136

Closed
dfjmulder opened this issue Dec 21, 2018 · 16 comments
Closed

Start-GSDriveFileUpload only writes to domain superadmin drive #136

dfjmulder opened this issue Dec 21, 2018 · 16 comments
Assignees
Labels

Comments

@dfjmulder
Copy link

Followed the install as on the wiki page.
Am able to read file list from all users drive

When running Start-GSDriveFileUpload there is a drive folder with the users name to the superadmin drive instead of the drive of the user.

update PSGSuite, recreated the project in console to see if I missed any steps...

Please help :-)

@scrthq
Copy link
Member

scrthq commented Dec 21, 2018

Hi! Drive API functions authenticate as the user specified in the -User parameter, which defaults to the AdminEmail user in the config. If you want to upload the file as another user, pass their primaryEmail to the User parameter. Hope that helps!

Sent with GitHawk

@scrthq scrthq self-assigned this Dec 21, 2018
@dfjmulder
Copy link
Author

I've predefined $homepath and am running it like (with a different email obviously):
Start-GSDriveFileUpload -Path $homePath -User mail@email.com -Recurse -Wait

@scrthq
Copy link
Member

scrthq commented Dec 21, 2018

hey @dfjmulder - Trying to figure out exactly what the issue is. My understanding of the issue is this (please correct me if I'm wrong!):

  1. mail@email.com is not the AdminEmail user configured on the PSGSuiteConfig. For the sake of understanding, we'll call the AdminEmail admin@email.com.
  2. You're trying to upload files to Drive for mail@email.com.
  3. Uploaded files are showing up under admin@email.com's Drive with admin@email.com as the owner, but mail@email.com should be the owner.

Is that an accurate portrayal of what's happening?

@dfjmulder
Copy link
Author

Yes. Thats correct.
And PSGSuite gives an error per file if I use the wait option. I am assuming cause it cannot find the files under the correct User. If i do not use the wait option than it reports like nothing has gone wrong.
And the api in cloudconsole is full of errors.

@scrthq
Copy link
Member

scrthq commented Dec 22, 2018 via email

@scrthq
Copy link
Member

scrthq commented Dec 23, 2018

hey @dfjmulder - Can you send over the errors you're seeing in both PowerShell and the Developer's Console? Considering you're seeing errors in the Dev Console / Cloud Console, it seems like the parameters that you're trying to pass may not be liked too much on the Google side. I'm not able to replicate any issues on my end when I try to upload as another user in my domain.

@dfjmulder
Copy link
Author

Command given: (username and domain changed)

Start-GSDriveFileUpload -Path \Server02\Homedirs$\username\ -User username@domain.nl -Recurse -Wait

Powershell error

WARNING: The following files failed to upload:

Powershell errorId : 4307
Status : Failed
Exception : The service drive has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
File not found: 1raDctkEXmcPcRS0t51d1lvroUUfKwiqe. [404]
Errors [
Message[File not found: 1raDctkEXmcPcRS0t51d1lvroUUfKwiqe.] Location[fileId - parameter] Reason[notFound] Domain[global]
]

           at Google.Apis.Upload.ResumableUpload`1.<InitiateSessionAsync>d__25.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at Google.Apis.Upload.ResumableUpload.<UploadAsync>d__70.MoveNext()

File : \Server02\Homedirs$\username\Afwezigheid Facilitair\Bij vakantie.docx

Repeated for each file.
There is a folder-structure in the superadmin drive created with the username as folder in the drive root and files+folder structure replicated there. Now owned by the superuser.

The google Drive API Metrics in console.cloud.google shows 404 errors for the drive.files.create method for the serviceaccount and oauth2 credential thats also in the config file.

Im trying to download the error file from the metrics page but this somehow seems to take forever. wille update onces that succeded

@dfjmulder
Copy link
Author

If I create a new folder in his drive than it all works dandy

New-GSDriveFile -Name "testfolder" -User username -MimeType DriveFolder

folder is created no issues

@scrthq
Copy link
Member

scrthq commented Dec 24, 2018

Thanks for the extra details! Seeing if I can replicate this on my end =]

@scrthq scrthq added bug and removed question labels Dec 24, 2018
@dfjmulder
Copy link
Author

👍

@dfjmulder
Copy link
Author

Looking at your code I do not understand how the functions you call inside this function know the User to send the files to. As the -User parameter does not appear to be handed down to them.

@scrthq
Copy link
Member

scrthq commented Dec 24, 2018

@dfjmulder you're absolutely right and I was able to validate the same behavior on my end! Validating the fix now, but should have a new version rolled out soon!

@dfjmulder
Copy link
Author

Thats great. Thanks man!

@scrthq
Copy link
Member

scrthq commented Dec 24, 2018

image

Looking good now! Should have a new version available in the next 30 mins.

scrthq added a commit that referenced this issue Dec 24, 2018
## 2.21.2

* [Issue #136](#136)
  * Fixed: `Start-GSDriveFileUpload` failing when specifying a user other than the Admin user to do the upload as.
@dfjmulder
Copy link
Author

Can confirm this has fixed it! Thank you for your great work.

@scrthq
Copy link
Member

scrthq commented Dec 24, 2018

Thanks for confirming! I'm glad you're enjoying PSGSuite!

Sent with GitHawk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants