From 235f2dfee88446251cd2758abf5301edfe394dfd Mon Sep 17 00:00:00 2001 From: Nate Ferrell Date: Fri, 20 Mar 2020 01:49:43 -0500 Subject: [PATCH 1/2] v2.36.3 ready for release ## 2.36.3 - 2020-03-20 * [Issue #270](https://github.com/scrthq/PSGSuite/issues/270) * Added `CheckAll` switch parameter to `Get-GSUserLicense` * Updated `User` parameter aliases for all `*-GSUserLicense` functions to include `UserId` for better pipeline support. * Miscellaneous * Updated GitHub Release section in psake.ps1 to POST the release to the Org URL due to failures. --- CHANGELOG.md | 9 ++++++++ PSGSuite/PSGSuite.psd1 | 2 +- .../Public/Licensing/Get-GSUserLicense.ps1 | 22 ++++++++++++------- .../Public/Licensing/Remove-GSUserLicense.ps1 | 2 +- .../Public/Licensing/Set-GSUserLicense.ps1 | 2 +- .../Public/Licensing/Update-GSUserLicense.ps1 | 2 +- README.md | 8 +++++++ psake.ps1 | 2 +- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63735b85..fa300e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ * [PSGSuite - ChangeLog](#psgsuite---changelog) + * [2.36.3 - 2020-03-20](#2363---2020-03-20) * [2.36.2 - 2020-03-02](#2362---2020-03-02) * [2.36.1 - 2020-03-02](#2361---2020-03-02) * [2.36.0 - 2020-02-28](#2360---2020-02-28) @@ -109,6 +110,14 @@ # PSGSuite - ChangeLog +## 2.36.3 - 2020-03-20 + +* [Issue #270](https://github.com/scrthq/PSGSuite/issues/270) + * Added `CheckAll` switch parameter to `Get-GSUserLicense` + * Updated `User` parameter aliases for all `*-GSUserLicense` functions to include `UserId` for better pipeline support. +* Miscellaneous + * Updated GitHub Release section in psake.ps1 to POST the release to the Org URL due to failures. + ## 2.36.2 - 2020-03-02 * [Issue #263](https://github.com/scrthq/PSGSuite/issues/263) diff --git a/PSGSuite/PSGSuite.psd1 b/PSGSuite/PSGSuite.psd1 index d97de64b..d7158ebc 100644 --- a/PSGSuite/PSGSuite.psd1 +++ b/PSGSuite/PSGSuite.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSGSuite.psm1' # Version number of this module. - ModuleVersion = '2.36.2' + ModuleVersion = '2.36.3' # ID used to uniquely identify this module GUID = '9d751152-e83e-40bb-a6db-4c329092aaec' diff --git a/PSGSuite/Public/Licensing/Get-GSUserLicense.ps1 b/PSGSuite/Public/Licensing/Get-GSUserLicense.ps1 index 6f60421d..93c09156 100644 --- a/PSGSuite/Public/Licensing/Get-GSUserLicense.ps1 +++ b/PSGSuite/Public/Licensing/Get-GSUserLicense.ps1 @@ -21,6 +21,9 @@ function Get-GSUserLicense { .PARAMETER Limit The maximum amount of results you want returned. Exclude or set to 0 to return all results + .PARAMETER CheckAll + If $true, force a check of all license products when specifying a User. This will return all license types it finds for a specific user instead of the default behavior of short circuiting after matching against the first license assigned. + .EXAMPLE Get-GSUserLicense @@ -31,7 +34,7 @@ function Get-GSUserLicense { Param ( [parameter(Mandatory = $false, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = "Get")] - [Alias("PrimaryEmail", "UserKey", "Mail")] + [Alias("PrimaryEmail", "UserKey", "Mail","UserId")] [ValidateNotNullOrEmpty()] [String[]] $User, @@ -43,7 +46,10 @@ function Get-GSUserLicense { [parameter(Mandatory = $false, ParameterSetName = "List")] [Alias('First')] [Int] - $Limit = 0 + $Limit = 0, + [parameter(ParameterSetName = "Get")] + [Switch] + $CheckAll ) DynamicParam { $paramDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary @@ -106,24 +112,24 @@ function Get-GSUserLicense { } else { foreach ($License in (Get-LicenseSkuFromDisplayName).Keys | Sort-Object) { + $response = $null Write-Verbose "Getting License SKU '$License' for User '$U'" $License = Get-LicenseSkuFromDisplayName $License try { $request = $service.LicenseAssignments.Get((Get-LicenseSkuToProductHash $License), $License, $U) $response = $request.Execute() } - catch { - } - if ($response) { + catch {} + if (-not $CheckAll -and $response) { break } + elseif ($response) { + $response + } } if (!$response) { Write-Warning "No license found for $U!" } - else { - $response - } } } } diff --git a/PSGSuite/Public/Licensing/Remove-GSUserLicense.ps1 b/PSGSuite/Public/Licensing/Remove-GSUserLicense.ps1 index 1ae8b0fd..088d1c81 100644 --- a/PSGSuite/Public/Licensing/Remove-GSUserLicense.ps1 +++ b/PSGSuite/Public/Licensing/Remove-GSUserLicense.ps1 @@ -21,7 +21,7 @@ function Remove-GSUserLicense { Param ( [parameter(Mandatory = $true,Position = 0,ValueFromPipeline = $true,ValueFromPipelineByPropertyName = $true)] - [Alias("PrimaryEmail","UserKey","Mail")] + [Alias("PrimaryEmail","UserKey","Mail","UserId")] [ValidateNotNullOrEmpty()] [string[]] $User diff --git a/PSGSuite/Public/Licensing/Set-GSUserLicense.ps1 b/PSGSuite/Public/Licensing/Set-GSUserLicense.ps1 index 7984f9ec..394af88e 100644 --- a/PSGSuite/Public/Licensing/Set-GSUserLicense.ps1 +++ b/PSGSuite/Public/Licensing/Set-GSUserLicense.ps1 @@ -22,7 +22,7 @@ function Set-GSUserLicense { Param ( [parameter(Mandatory = $true,Position = 0,ValueFromPipeline = $true,ValueFromPipelineByPropertyName = $true)] - [Alias("PrimaryEmail","UserKey","Mail")] + [Alias("PrimaryEmail","UserKey","Mail","UserId")] [ValidateNotNullOrEmpty()] [String[]] $User diff --git a/PSGSuite/Public/Licensing/Update-GSUserLicense.ps1 b/PSGSuite/Public/Licensing/Update-GSUserLicense.ps1 index 51164f95..7c1c912e 100644 --- a/PSGSuite/Public/Licensing/Update-GSUserLicense.ps1 +++ b/PSGSuite/Public/Licensing/Update-GSUserLicense.ps1 @@ -22,7 +22,7 @@ function Update-GSUserLicense { Param ( [parameter(Mandatory = $false,Position = 0,ValueFromPipeline = $true,ValueFromPipelineByPropertyName = $true)] - [Alias("PrimaryEmail","UserKey","Mail")] + [Alias("PrimaryEmail","UserKey","Mail","UserId")] [ValidateNotNullOrEmpty()] [String[]] $User diff --git a/README.md b/README.md index 757afff2..30a85c18 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,14 @@ 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.36.3 - 2020-03-20 + +* [Issue #270](https://github.com/scrthq/PSGSuite/issues/270) + * Added `CheckAll` switch parameter to `Get-GSUserLicense` + * Updated `User` parameter aliases for all `*-GSUserLicense` functions to include `UserId` for better pipeline support. +* Miscellaneous + * Updated GitHub Release section in psake.ps1 to POST the release to the Org URL due to failures. + #### 2.36.2 - 2020-03-02 * [Issue #263](https://github.com/scrthq/PSGSuite/issues/263) diff --git a/psake.ps1 b/psake.ps1 index 24a2eecf..876d3ec1 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -556,7 +556,7 @@ $deployScriptBlock = { CommitId = $commitId ReleaseNotes = $ReleaseNotes ArtifactPath = $zipPath - GitHubUsername = 'scrthq' + GitHubUsername = 'SCRT-HQ' GitHubRepository = $env:BHProjectName GitHubApiKey = $env:GitHubPAT Draft = $false From 8d369e3ef92632c742bc78e531c02916a381dfba Mon Sep 17 00:00:00 2001 From: Nate Ferrell Date: Fri, 20 Mar 2020 01:58:31 -0500 Subject: [PATCH 2/2] moved deployment tweet to before the GitHub Release section --- psake.ps1 | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/psake.ps1 b/psake.ps1 index 876d3ec1..eb168b3c 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -521,6 +521,24 @@ $deployScriptBlock = { " [SKIPPED] Deployment of version [$($versionToDeploy)] to PSGallery" } $commitId = git rev-parse --verify HEAD + if ($ENV:BHBuildSystem -eq 'VSTS' -and -not [String]::IsNullOrEmpty($env:TwitterAccessSecret) -and -not [String]::IsNullOrEmpty($env:TwitterAccessToken) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerKey) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerSecret)) { + " Publishing tweet about new release..." + $manifest = Import-PowerShellDataFile -Path (Join-Path $outputModVerDir "$($env:BHProjectName).psd1") + $text = "#$($env:BHProjectName) v$($versionToDeploy) is now available on the #PSGallery! https://www.powershellgallery.com/packages/$($env:BHProjectName)/$($versionToDeploy) #PowerShell" + $manifest.PrivateData.PSData.Tags | Foreach-Object { + $text += " #$($_)" + } + if ($text.Length -gt 280) { + " Trimming [$($text.Length - 280)] extra characters from tweet text to get to 280 character limit..." + $text = $text.Substring(0,280) + } + " Tweet text: $text" + Publish-Tweet -Tweet $text -ConsumerKey $env:TwitterConsumerKey -ConsumerSecret $env:TwitterConsumerSecret -AccessToken $env:TwitterAccessToken -AccessSecret $env:TwitterAccessSecret + " Tweet successful!" + } + else { + " [SKIPPED] Twitter update of new release" + } if (-not [String]::IsNullOrEmpty($env:GitHubPAT)) { " Creating Release ZIP..." $zipPath = [System.IO.Path]::Combine($PSScriptRoot,"$($env:BHProjectName).zip") @@ -567,24 +585,6 @@ $deployScriptBlock = { else { " [SKIPPED] Publishing Release v$($versionToDeploy) @ commit Id [$($commitId)] to GitHub" } - if ($ENV:BHBuildSystem -eq 'VSTS' -and -not [String]::IsNullOrEmpty($env:TwitterAccessSecret) -and -not [String]::IsNullOrEmpty($env:TwitterAccessToken) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerKey) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerSecret)) { - " Publishing tweet about new release..." - $manifest = Import-PowerShellDataFile -Path (Join-Path $outputModVerDir "$($env:BHProjectName).psd1") - $text = "#$($env:BHProjectName) v$($versionToDeploy) is now available on the #PSGallery! https://www.powershellgallery.com/packages/$($env:BHProjectName)/$($versionToDeploy) #PowerShell" - $manifest.PrivateData.PSData.Tags | Foreach-Object { - $text += " #$($_)" - } - if ($text.Length -gt 280) { - " Trimming [$($text.Length - 280)] extra characters from tweet text to get to 280 character limit..." - $text = $text.Substring(0,280) - } - " Tweet text: $text" - Publish-Tweet -Tweet $text -ConsumerKey $env:TwitterConsumerKey -ConsumerSecret $env:TwitterConsumerSecret -AccessToken $env:TwitterAccessToken -AccessSecret $env:TwitterAccessSecret - " Tweet successful!" - } - else { - " [SKIPPED] Twitter update of new release" - } } catch { Write-Error $_ -ErrorAction Stop