SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
235 stars 67 forks source link

Add-GSDrivePermission does not support fileOrganizer role for Team Drives #182

Closed cdwcriver closed 5 years ago

cdwcriver commented 5 years ago

Describe the bug Team Drives support a "Content Manager" role, which is called "fileOrganizer" in the API. However, PSGsuite currently does not support this role.

To Reproduce

  1. Add-GSDrivePermission -User testuser@domain.com -FileId TeamDriveID -role fileOrganizer -Type User -EmailAddress testuser2@domain.com

Expected behavior The role should be added to the Team Drive.

Environment (please complete the following information):

Additional context In Add-GSDrivePermission.ps1, updating line 88 to include fileOrganizer in the ValidateSet, and updating line 168 to: $body.$key = ($PSBoundParameters[$key]).ToLower().Replace("fileorganizer","fileOrganizer") should do the trick (it works in my local environment). It seems the underlying API unfortunately requires the uppercase O.

scrthq commented 5 years ago

Thank you so much for the detailed analysis and quick fix! Google is definitely sensitive when it comes to casing, camelCase all the things. I'll add it in asap!

scrthq commented 5 years ago

hey @aitcriver - you should be good to go now on the latest version. Try it out and let me know!