diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 8e4572fba..6a1c471c2 100755 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -32,7 +32,7 @@ parameters: description: 'Release Type. Accepted values [ Major, Minor, Patch ]' type: enum enum: ["Major", "Minor", "Patch"] - default: "Minor" + default: "Patch" RequiredModulesRepo: description: 'PowerShell Repository for JumpCloud SDKs' type: enum @@ -45,7 +45,7 @@ parameters: PublishToPSGallery: description: 'When `true` and when run against Master branch, this workflow will publish the latest code to PSGallery' type: boolean - default: false + default: true ManualModuleVersion: description: 'When `true` the pipeline will use the Module Version specified in JumpCloud Module JumpCloud.psd1 file' type: boolean diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md index ece9505be..a21435f88 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCCommand.md @@ -56,9 +56,7 @@ Note that when running this command the time for the output to display will be d PS C:\> Get-JCCommand -name '*BitLocker*' | Get-JCCommand -ByID ``` -Returns all information describing all JumpCloud commands with a name of '*trigger*' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the name BitLocker somewhere in the name would be returned. - -Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. +Returns all information describing all JumpCloud commands with a name of '*BitLocker*' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "BitLocker" somewhere in the name would be returned. ### Example 5 ```powershell @@ -74,9 +72,7 @@ Note that when running this command the time for the output to display will be d PS C:\> Get-JCCommand -command '*fdesetup*' | Get-JCCommand -ByID ``` -Returns all information describing all JumpCloud commands with a command string and the search term "fdesetup", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. - -Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. +Returns all information describing all JumpCloud commands with a command string and the search term "*fdesetup*", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. ## PARAMETERS diff --git a/PowerShell/JumpCloud Module/Docs/Get-JCUser.md b/PowerShell/JumpCloud Module/Docs/Get-JCUser.md index 27b482931..422b8b7c9 100644 --- a/PowerShell/JumpCloud Module/Docs/Get-JCUser.md +++ b/PowerShell/JumpCloud Module/Docs/Get-JCUser.md @@ -583,6 +583,7 @@ A search filter to return users that are in an ACTIVATED or SUSPENDED state Type: System.String Parameter Sets: SearchFilter Aliases: +Accepted values: ACTIVATED, SUSPENDED, STAGED Required: False Position: Named diff --git a/PowerShell/JumpCloud Module/Docs/JumpCloud.md b/PowerShell/JumpCloud Module/Docs/JumpCloud.md index 0d95a1d73..379097009 100644 --- a/PowerShell/JumpCloud Module/Docs/JumpCloud.md +++ b/PowerShell/JumpCloud Module/Docs/JumpCloud.md @@ -2,7 +2,7 @@ Module Name: JumpCloud Module Guid: 31c023d1-a901-48c4-90a3-082f91b31646 Download Help Link: https://github.com/TheJumpCloud/support/wiki -Help Version: 1.23.0 +Help Version: 1.23.1 Locale: en-US --- diff --git a/PowerShell/JumpCloud Module/JumpCloud.psd1 b/PowerShell/JumpCloud Module/JumpCloud.psd1 index 7dda14111..5d5e9e5a7 100755 --- a/PowerShell/JumpCloud Module/JumpCloud.psd1 +++ b/PowerShell/JumpCloud Module/JumpCloud.psd1 @@ -3,7 +3,7 @@ # # Generated by: JumpCloud Solutions Architect Team # -# Generated on: 6/22/2022 +# Generated on: 7/7/2022 # @{ @@ -12,7 +12,7 @@ RootModule = 'JumpCloud.psm1' # Version number of this module. -ModuleVersion = '1.23.0' +ModuleVersion = '1.23.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerShell/JumpCloud Module/Public/Users/Get-JCUser.ps1 b/PowerShell/JumpCloud Module/Public/Users/Get-JCUser.ps1 index 4e8f8c8b0..24bbcca62 100644 --- a/PowerShell/JumpCloud Module/Public/Users/Get-JCUser.ps1 +++ b/PowerShell/JumpCloud Module/Public/Users/Get-JCUser.ps1 @@ -121,6 +121,7 @@ Function Get-JCUser () [String]$manager, [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'A search filter to return users that are in an ACTIVATED, STAGED or SUSPENDED state')] + [ValidateSet('ACTIVATED','SUSPENDED','STAGED')] [String]$state, [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'SearchFilter', HelpMessage = 'The recovery email of the JumpCloud user you wish to search for.')] @@ -384,6 +385,19 @@ Function Get-JCUser () } } + # case insensitve state param + if ("state" -eq $param.Key) + { + if ($param.Value -cin @('ACTIVATED', 'SUSPENDED', 'STAGED')) + { + $stateValue = $param.Value + } + else { + $stateValue = ($param.Value).ToUpper() + } + continue + } + $Value = ($param.value).replace('*', '') if (($param.Value -match '.+?\*$') -and ($param.Value -match '^\*.+?')) @@ -416,9 +430,15 @@ Function Get-JCUser () { (($Search.filter).GetEnumerator()).add('recoveryEmail.address', $recoveryEmail ) } + if ($stateValue) + { + (($Search.filter).GetEnumerator()).add('state', $stateValue ) + } $SearchJSON = $Search | ConvertTo-Json -Compress -Depth 4 + Write-Debug $SearchJSON + $URL = "$JCUrlBasePath/api/search/systemusers" $Results = Invoke-RestMethod -Method POST -Uri $Url -Header $hdrs -Body $SearchJSON -UserAgent:(Get-JCUserAgent) diff --git a/PowerShell/JumpCloud Module/Tests/Public/Users/Get-JCUser.tests.ps1 b/PowerShell/JumpCloud Module/Tests/Public/Users/Get-JCUser.tests.ps1 index 3707ee602..d49ea29bc 100755 --- a/PowerShell/JumpCloud Module/Tests/Public/Users/Get-JCUser.tests.ps1 +++ b/PowerShell/JumpCloud Module/Tests/Public/Users/Get-JCUser.tests.ps1 @@ -105,19 +105,31 @@ Describe -Tag:('JCUser') 'Get-JCUser 1.1' { It "Searches a JumpCloud user by state SUSPENDED" { $NewUser = New-RandomUser -Domain DeleteMe | New-JcUser -state "SUSPENDED" $SearchUser = Get-JCUser -state "SUSPENDED" | Select-Object -First 1 + $SearchUserLower = Get-JCUser -state "suspended" | Select-Object -First 1 + $SearchUserMixed = Get-JCUser -state "Suspended" | Select-Object -First 1 $SearchUser.state | Should -Be "SUSPENDED" + $SearchUserLower.state | Should -Be "SUSPENDED" + $SearchUserMixed.state | Should -Be "SUSPENDED" Remove-JCUser -UserId $NewUser._id -force } It "Searches a JumpCloud user by state STAGED" { $NewUser = New-RandomUser -Domain DeleteMe | New-JcUser -state "STAGED" $SearchUser = Get-JCUser -state "STAGED" | Select-Object -First 1 + $SearchUserLower = Get-JCUser -state "staged" | Select-Object -First 1 + $SearchUserMixed = Get-JCUser -state "Staged" | Select-Object -First 1 $SearchUser.state | Should -Be "STAGED" + $SearchUserLower.state | Should -Be "STAGED" + $SearchUserMixed.state | Should -Be "STAGED" Remove-JCUser -UserId $NewUser._id -force } It "Searches a JumpCloud user by state ACTIVATED" { $NewUser = New-RandomUser -Domain DeleteMe | New-JcUser -state "ACTIVATED" $SearchUser = Get-JCUser -state "ACTIVATED" | Select-Object -First 1 + $SearchUserLower = Get-JCUser -state "activated" | Select-Object -First 1 + $SearchUserMixed = Get-JCUser -state "Activated" | Select-Object -First 1 $SearchUser.state | Should -Be "ACTIVATED" + $SearchUserLower.state | Should -Be "ACTIVATED" + $SearchUserMixed.state | Should -Be "ACTIVATED" Remove-JCUser -UserId $NewUser._id -force } diff --git a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml index 85a77563c..44c6f2749 100644 --- a/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml +++ b/PowerShell/JumpCloud Module/en-Us/JumpCloud-help.xml @@ -3769,8 +3769,7 @@ PS C:\> $BackupJcOrganizationResults.User -------------------------- Example 4 -------------------------- PS C:\> Get-JCCommand -name '*BitLocker*' | Get-JCCommand -ByID - Returns all information describing all JumpCloud commands with a name of ' trigger ' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the name BitLocker somewhere in the name would be returned. - Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + Returns all information describing all JumpCloud commands with a name of ' BitLocker ' by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "BitLocker" somewhere in the name would be returned. @@ -3785,8 +3784,7 @@ PS C:\> $BackupJcOrganizationResults.User -------------------------- Example 6 -------------------------- PS C:\> Get-JCCommand -command '*fdesetup*' | Get-JCCommand -ByID - Returns all information describing all JumpCloud commands with a command string and the search term "fdesetup", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. - Note that when running this command the time for the output to display will be directly proportionate to how many JumpCloud commands you have with a launchType of 'trigger'. The command 'Get-JCCommand -ByID' runs once for every JumpCloud command within your tenant with a launchType of 'trigger'. + Returns all information describing all JumpCloud commands with a command string and the search term " fdesetup ", by passing the -CommandID Parameter to the -ByID Parameter using the pipeline and Parameter Binding. Note, search parameters on Get-JCCommand support wildcard characters. In this example commands with the string "fdesetup" somewhere in the command body would be returned. @@ -7855,6 +7853,11 @@ PS C:\> $BackupJcOrganizationResults.User A search filter to return users that are in an ACTIVATED or SUSPENDED state + + ACTIVATED + SUSPENDED + STAGED + System.String System.String diff --git a/PowerShell/ModuleBanner.md b/PowerShell/ModuleBanner.md index 57feda7b0..9de6a5fc1 100755 --- a/PowerShell/ModuleBanner.md +++ b/PowerShell/ModuleBanner.md @@ -1,17 +1,17 @@ #### Latest Version ``` -1.23.0 +1.23.1 ``` #### Banner Current ``` -* Added search endpoint functionality and parameters to Get-jCCommand +* Get-JCUser -State should accept case insensitive values such as "suspended" "activated" "staged" and validate input ``` #### Banner Old ``` -* Added functionality for Set, Get, New-JCUser to Search by Email to Manager Field +* Added search endpoint functionality and parameters to Get-jCCommand ``` diff --git a/PowerShell/ModuleChangelog.md b/PowerShell/ModuleChangelog.md index fd2750d88..3122e5a63 100644 --- a/PowerShell/ModuleChangelog.md +++ b/PowerShell/ModuleChangelog.md @@ -1,3 +1,12 @@ +## 1.23.1 + +Release Date: June 21, 2022 + +#### RELEASE NOTES + +This release adds validate to the Get-JCUser -State parameter set. It should now validate supplied acceptable values. +Documentation for Get-JCCommand updated thanks to JumpCloud Community member: Ryan Bailey @rybai + ## 1.23.0 Release Date: June 21, 2022