Skip to content

Commit

Permalink
Merge pull request #386 from pspete/dev
Browse files Browse the repository at this point in the history
Fix 5.2
  • Loading branch information
pspete authored Nov 7, 2021
2 parents 4e9aaab + c1802ea commit 909248b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
- Continued development to encompass any new documented features of the CyberArk API.
- psPAS v6.0...

## **5.2.xx (November 7th 2021)**

- Fix
- Resolves issue where `Get-PASSafeMember` would fail with error when using Gen2 API and specifying `MemberName` parameter.
- Resolves issue where `Set-PASSafe` would fail with error when using Gen2 API.
- (Thanks [alexR148](https://github.com/alexR148)!).

## **5.2.54 (July 28th 2021)**

- Fix
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ $Safes = Get-PASSafe -search TestSafe
#Delete Safes
foreach ($Safe in $Safes){
Remove-PASSafe -SafeName $Safe -WhatIf
Remove-PASSafe -SafeName $Safe.SafeName -WhatIf
}
Expand Down
2 changes: 1 addition & 1 deletion docs/collections/_docs/30-bulk-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ $Safes = Get-PASSafe -search TestSafe
#Delete Safes
foreach ($Safe in $Safes){
Remove-PASSafe -SafeName $Safe -WhatIf
Remove-PASSafe -SafeName $Safe.SafeName -WhatIf
}
Expand Down
32 changes: 15 additions & 17 deletions psPAS/Functions/SafeMembers/Get-PASSafeMember.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -266,37 +266,35 @@ function Get-PASSafeMember {

( { $PSItem -match '^Gen2' } ) {

$Total = $result.Count
If ($null -ne $result) {

If ($Total -gt 0) {

$Members = [Collections.Generic.List[Object]]::New(($result.value))
switch ($PSCmdlet.ParameterSetName) {

For ( $Offset = $Limit ; $Offset -lt $Total ; $Offset += $Limit ) {
'Gen2-MemberPermissions' {

$Null = $Members.AddRange((Invoke-PASRestMethod -Uri "$URI`?limit=$Limit&OffSet=$Offset" -Method GET -WebSession $Script:WebSession -TimeoutSec $TimeoutSec).value)
$Output = $result

}
break

$Output = $Members
}

}
default {

ElseIf ($null -ne $result) {
$Total = $result.Count

switch ($PSCmdlet.ParameterSetName) {
If ($Total -gt 0) {

'Gen2-MemberPermissions' {
$Members = [Collections.Generic.List[Object]]::New(($result.value))

$Output = $result
For ( $Offset = $Limit ; $Offset -lt $Total ; $Offset += $Limit ) {

break
$Null = $Members.AddRange((Invoke-PASRestMethod -Uri "$URI`?limit=$Limit&OffSet=$Offset" -Method GET -WebSession $Script:WebSession -TimeoutSec $TimeoutSec).value)

}
}

default {
$Output = $Members

$Output = $result.value
}

}

Expand Down
12 changes: 6 additions & 6 deletions psPAS/Functions/Safes/Set-PASSafe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Set-PASSafe {

[parameter(
Mandatory = $false,
ValueFromPipelinebyPropertyName = $false
ValueFromPipelinebyPropertyName = $true
)]
[ValidateLength(0, 100)]
[string]$Description,
Expand All @@ -48,7 +48,7 @@ function Set-PASSafe {

[parameter(
Mandatory = $false,
ValueFromPipelinebyPropertyName = $false
ValueFromPipelinebyPropertyName = $true
)]
[string]$ManagingCPM,

Expand All @@ -59,7 +59,7 @@ function Set-PASSafe {
)]
[parameter(
Mandatory = $false,
ValueFromPipelinebyPropertyName = $false,
ValueFromPipelinebyPropertyName = $true,
ParameterSetName = 'Gen1-NumberOfVersionsRetention'
)]
[ValidateRange(1, 999)]
Expand All @@ -72,7 +72,7 @@ function Set-PASSafe {
)]
[parameter(
Mandatory = $false,
ValueFromPipelinebyPropertyName = $false,
ValueFromPipelinebyPropertyName = $true,
ParameterSetName = 'Gen1-NumberOfDaysRetention'
)]
[ValidateRange(1, 3650)]
Expand All @@ -98,7 +98,7 @@ function Set-PASSafe {

$typename = 'psPAS.CyberArk.Vault.Safe'

$BoundParameters = $PSBoundParameters | Get-PASParameter -ParametersToRemove SafeName, NewSafeName
$BoundParameters = $PSBoundParameters | Get-PASParameter -ParametersToRemove NewSafeName

if ($PSBoundParameters.ContainsKey('NewSafeName')) {

Expand Down Expand Up @@ -181,4 +181,4 @@ function Set-PASSafe {

END { }#end

}
}

0 comments on commit 909248b

Please sign in to comment.