Skip to content

Commit

Permalink
!deploy v2.31.1 (#227)
Browse files Browse the repository at this point in the history
## 2.31.1 - 2019-08-30

* [Issue #222](#222)
  * Fixed: `Remove-GSUserASP` and `Remove-GSUserToken` not removing all when no Id is passed due to no service being created.
* [Issue #225](#225)
  * Added: `RecoveryEmail` and `RecoveryPhone` parameters to `Update-GSUser`
* [Issue #189](#189)
  * Removed `$env:UserName` from the application name when creating the client in `New-GoogleService` to prevent errors with the underlying .NET SDK.
* Miscellaneous
  * Fixed: Corrected logic on the `FullName` parameter on `Update-GSUser` to parse the name parts.
  * Updated Google .NET SDKs to latest versions.
  • Loading branch information
scrthq authored Aug 30, 2019
2 parents 43e3630 + 4efc41b commit de6bdd0
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 79 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [PSGSuite - ChangeLog](#psgsuite---changelog)
* [2.31.1 - 2019-08-30](#2311---2019-08-30)
* [2.31.0](#2310)
* [2.30.2](#2302)
* [2.30.1](#2301)
Expand Down Expand Up @@ -95,6 +96,18 @@

# PSGSuite - ChangeLog

## 2.31.1 - 2019-08-30

* [Issue #222](https://github.com/scrthq/PSGSuite/issues/222)
* Fixed: `Remove-GSUserASP` and `Remove-GSUserToken` not removing all when no Id is passed due to no service being created.
* [Issue #225](https://github.com/scrthq/PSGSuite/issues/225)
* Added: `RecoveryEmail` and `RecoveryPhone` parameters to `Update-GSUser`
* [Issue #189](https://github.com/scrthq/PSGSuite/issues/189)
* Removed `$env:UserName` from the application name when creating the client in `New-GoogleService` to prevent errors with the underlying .NET SDK.
* Miscellaneous
* Fixed: Corrected logic on the `FullName` parameter on `Update-GSUser` to parse the name parts.
* Updated Google .NET SDKs to latest versions.

## 2.31.0

* [Issue #218](https://github.com/scrthq/PSGSuite/issues/218)
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.31.0'
ModuleVersion = '2.31.1'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/Public/Authentication/New-GoogleService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function New-GoogleService {
}
$svc = New-Object "$ServiceType" (New-Object 'Google.Apis.Services.BaseClientService+Initializer' -Property @{
HttpClientInitializer = $credential
ApplicationName = "PSGSuite - $env:USERNAME"
ApplicationName = "PSGSuite"
}
)
$script:_PSGSuiteSessions[$sessionKey] = ([PSCustomObject]@{
Expand Down
20 changes: 9 additions & 11 deletions PSGSuite/Public/Security/Remove-GSUserASP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<#
.SYNOPSIS
Removes an Application Specific Password for a user
.DESCRIPTION
Removes an Application Specific Password for a user
.PARAMETER User
The user to remove ASPs ValueFromPipeline
.PARAMETER CodeId
The ASP Code Id to remove. If excluded, all ASPs for the user will be removed
.EXAMPLE
Remove-GSUserASP -User joe
Expand All @@ -30,13 +30,11 @@
$CodeId
)
Begin {
if ($PSBoundParameters.Keys -contains 'CodeId') {
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/admin.directory.user.security'
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService'
}
$service = New-GoogleService @serviceParams
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/admin.directory.user.security'
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService'
}
$service = New-GoogleService @serviceParams
}
Process {
try {
Expand Down Expand Up @@ -78,4 +76,4 @@
}
}
}
}
}
22 changes: 10 additions & 12 deletions PSGSuite/Public/Security/Remove-GSUserToken.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<#
.SYNOPSIS
Removes a security token from a user
.DESCRIPTION
Removes a security token from a user
.PARAMETER User
The user to remove the security token from
.PARAMETER ClientID
The client Id of the security token. If excluded, all security tokens for the user are removed
.EXAMPLE
An example
.NOTES
General notes
#>
Expand All @@ -31,13 +31,11 @@
$ClientID
)
Begin {
if ($PSBoundParameters.Keys -contains 'ClientID') {
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/admin.directory.user.security'
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService'
}
$service = New-GoogleService @serviceParams
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/admin.directory.user.security'
ServiceType = 'Google.Apis.Admin.Directory.directory_v1.DirectoryService'
}
$service = New-GoogleService @serviceParams
}
Process {
try {
Expand Down Expand Up @@ -79,4 +77,4 @@
}
}
}
}
}
32 changes: 27 additions & 5 deletions PSGSuite/Public/Users/Update-GSUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ function Update-GSUser {
To CLEAR all values for a user, pass `$null` as the value for this parameter.
.PARAMETER RecoveryEmail
Recovery email of the user.
.PARAMETER RecoveryPhone
Recovery phone of the user. The phone number must be in the E.164 format, starting with the plus sign (+). Example: +16506661212. The value provided for RecoveryPhone is stripped of all non-digit characters and prepended with a + to ensure correct formatting.
.PARAMETER Relations
A list of the user's relationships to other users.
Expand Down Expand Up @@ -129,7 +135,7 @@ function Update-GSUser {
Updates user [email protected] with a new primary email of "[email protected]", sets their Given Name to "Johnathan" and unsuspends them. Their previous primary email "[email protected]" will become an alias on their account automatically
#>
[OutputType('Google.Apis.Admin.Directory.directory_v1.Data.User')]
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High",DefaultParameterSetName = "NamePart")]
Param
(
[parameter(Mandatory = $true, Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand All @@ -140,13 +146,13 @@ function Update-GSUser {
[parameter(Mandatory = $false)]
[String]
$PrimaryEmail,
[parameter(Mandatory = $false)]
[parameter(Mandatory = $false,ParameterSetName = "NamePart")]
[String]
$GivenName,
[parameter(Mandatory = $false)]
[parameter(Mandatory = $false,ParameterSetName = "NamePart")]
[String]
$FamilyName,
[parameter(Mandatory = $false)]
[parameter(Mandatory = $false,ParameterSetName = "FullName")]
[String]
$FullName,
[parameter(Mandatory = $false)]
Expand Down Expand Up @@ -183,6 +189,12 @@ function Update-GSUser {
[Google.Apis.Admin.Directory.directory_v1.Data.UserRelation[]]
$Relations,
[parameter(Mandatory = $false)]
[String]
$RecoveryEmail,
[parameter(Mandatory = $false)]
[String]
$RecoveryPhone,
[parameter(Mandatory = $false)]
[Google.Apis.Admin.Directory.directory_v1.Data.UserPhone[]]
$Phones,
[parameter(Mandatory = $false)]
Expand Down Expand Up @@ -246,7 +258,17 @@ function Update-GSUser {
$nameUpdated = $true
}
FullName {
$name.$prop = $PSBoundParameters[$prop]
$fName = $PSBoundParameters[$prop]
if ($fName -match ',') {
$splitName = ($fName -split ',',2).Trim()
$name.FamilyName = $splitName[0]
$name.GivenName = $splitName[1]
}
else {
$splitName = ($fName -split ' ').Trim()
$name.FamilyName = $splitName[-1]
$name.GivenName = $splitName[0..$($splitName.Count - 2)] -join " "
}
$nameUpdated = $true
}
Password {
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ All other functions are either intact or have an alias included to support backw

[Full CHANGELOG here](https://github.com/scrthq/PSGSuite/blob/master/CHANGELOG.md)

#### 2.31.1 - 2019-08-30

* [Issue #222](https://github.com/scrthq/PSGSuite/issues/222)
* Fixed: `Remove-GSUserASP` and `Remove-GSUserToken` not removing all when no Id is passed due to no service being created.
* [Issue #225](https://github.com/scrthq/PSGSuite/issues/225)
* Added: `RecoveryEmail` and `RecoveryPhone` parameters to `Update-GSUser`
* [Issue #189](https://github.com/scrthq/PSGSuite/issues/189)
* Removed `$env:UserName` from the application name when creating the client in `New-GoogleService` to prevent errors with the underlying .NET SDK.
* Miscellaneous
* Fixed: Corrected logic on the `FullName` parameter on `Update-GSUser` to parse the name parts.
* Updated Google .NET SDKs to latest versions.

#### 2.31.0

* [Issue #218](https://github.com/scrthq/PSGSuite/issues/218)
Expand Down
94 changes: 47 additions & 47 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,56 +1,18 @@

[cmdletbinding(DefaultParameterSetName = 'task')]
[cmdletbinding()]
param(
[parameter(ParameterSetName = 'task', Position = 0)]
[parameter( Position = 0)]
[ValidateSet('Init','Clean','Compile','Import','Test','TestOnly','Deploy','Skip')]
[string[]]
$Task = @('Init','Clean','Compile','Import'),

[parameter(ParameterSetName = 'help')]
[switch]$Help,
[parameter()]
[Alias('nr','nor')]
[switch]$NoRestore,

[switch]$UpdateModules,
[switch]$Force
[switch]$Force,
[switch]$Help
)

$env:BuildProjectName = 'PSGSuite'
$env:_BuildStart = Get-Date -Format 'o'
$env:BuildScriptPath = $PSScriptRoot

. ([System.IO.Path]::Combine($PSScriptRoot,"ci","AzurePipelinesHelpers.ps1"))

Add-EnvironmentSummary "Build started"

Set-BuildVariables

Add-Heading "Setting package feeds"

$modHash = @{
PackageManagement = '1.3.1'
PowerShellGet = '2.1.2'
}
foreach ($module in $modHash.Keys | Sort-Object) {
Write-BuildLog "Updating $module module if needed"
if ($null -eq (Get-Module $module -ListAvailable | Where-Object {[System.Version]$_.Version -ge [System.Version]($modHash[$module])})) {
Write-BuildLog "$module is below the minimum required version! Updating"
Install-Module $module -MinimumVersion $modHash[$module] -Force -AllowClobber -SkipPublisherCheck -Scope CurrentUser -Verbose:$false
}
}

Invoke-CommandWithLog {Get-PackageProvider -Name Nuget -ForceBootstrap -Verbose:$false}
Invoke-CommandWithLog {Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -Verbose:$false}
Invoke-CommandWithLog {$PSDefaultParameterValues = @{
'*-Module:Verbose' = $false
'Import-Module:ErrorAction' = 'Stop'
'Import-Module:Force' = $true
'Import-Module:Verbose' = $false
'Install-Module:AllowClobber' = $true
'Install-Module:ErrorAction' = 'Stop'
'Install-Module:Force' = $true
'Install-Module:Scope' = 'CurrentUser'
'Install-Module:Verbose' = $false
}}

$update = @{}
$verbose = @{}
if ($PSBoundParameters.ContainsKey('UpdateModules')) {
Expand All @@ -60,16 +22,54 @@ if ($PSBoundParameters.ContainsKey('Verbose')) {
$verbose['Verbose'] = $PSBoundParameters['Verbose']
}

. ([System.IO.Path]::Combine($PSScriptRoot,"ci","AzurePipelinesHelpers.ps1"))

if ($Help) {
Add-Heading "Getting help"
Write-BuildLog -c '"psake" | Resolve-Module @update -Verbose'
'psake' | Resolve-Module @update -Verbose
Write-BuildLog -c '"psake" | Resolve-Module @update @Verbose'
'psake' | Resolve-Module @update @verbose
Write-BuildLog "psake script tasks:"
Get-PSakeScriptTasks -buildFile "$PSScriptRoot\psake.ps1" |
Sort-Object -Property Name |
Format-Table -Property Name, Description, Alias, DependsOn
}
else {
$env:BuildProjectName = 'PSGSuite'
$env:BuildScriptPath = $PSScriptRoot
$env:NoNugetRestore = $NoRestore

Add-EnvironmentSummary "Build started"

Set-BuildVariables

Add-Heading "Setting package feeds"

$modHash = @{
PackageManagement = '1.3.1'
PowerShellGet = '2.1.2'
}
foreach ($module in $modHash.Keys | Sort-Object) {
Write-BuildLog "Updating $module module if needed"
if ($null -eq (Get-Module $module -ListAvailable | Where-Object {[System.Version]$_.Version -ge [System.Version]($modHash[$module])})) {
Write-BuildLog "$module is below the minimum required version! Updating"
Install-Module $module -MinimumVersion $modHash[$module] -Force -AllowClobber -SkipPublisherCheck -Scope CurrentUser -Verbose:$false
}
}

Invoke-CommandWithLog {Get-PackageProvider -Name Nuget -ForceBootstrap -Verbose:$false}
Invoke-CommandWithLog {Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -Verbose:$false}
Invoke-CommandWithLog {$PSDefaultParameterValues = @{
'*-Module:Verbose' = $false
'Import-Module:ErrorAction' = 'Stop'
'Import-Module:Force' = $true
'Import-Module:Verbose' = $false
'Install-Module:AllowClobber' = $true
'Install-Module:ErrorAction' = 'Stop'
'Install-Module:Force' = $true
'Install-Module:Scope' = 'CurrentUser'
'Install-Module:Verbose' = $false
}}

Add-Heading "Finalizing build prerequisites"
if (
$Task -eq 'Deploy' -and -not $Force -and (
Expand Down
8 changes: 6 additions & 2 deletions ci/AzurePipelinesHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ function Add-Heading {
[Switch]
$Passthru
)
if (-not $env:_BuildStart) {
$env:_BuildStart = Get-Date -Format 'o'
}
$date = "[$((Get-Date).ToString("HH:mm:ss")) +$(((Get-Date) - (Get-Date $env:_BuildStart)).ToString())]"
$msgList = @(
''
Expand Down Expand Up @@ -281,6 +284,9 @@ function Write-BuildLog {
$Clean
)
Begin {
if (-not $env:_BuildStart) {
$env:_BuildStart = Get-Date -Format 'o'
}
if ($PSBoundParameters.ContainsKey('Debug') -and $PSBoundParameters['Debug'] -eq $true) {
$fg = 'Yellow'
$lvl = '##[debug] '
Expand Down Expand Up @@ -382,7 +388,6 @@ function Set-EnvironmentVariable {
$Value
)
$fullVal = $Value -join " "
Write-BuildLog "Setting env variable '$Name' to '$fullVal'"
Set-Item -Path Env:\$Name -Value $fullVal -Force
if ($IsCI) {
"##vso[task.setvariable variable=$Name]$fullVal" | Write-Host
Expand Down Expand Up @@ -419,7 +424,6 @@ function Set-BuildVariables {
BHCommitMessage = $((git log --format=%B -n 1).Trim())
}
}
Add-Heading 'Setting environment variables if needed'
foreach ($var in $gitVars.Keys) {
if (-not (Test-Path Env:\$var)) {
Set-EnvironmentVariable $var $gitVars[$var]
Expand Down

0 comments on commit de6bdd0

Please sign in to comment.