Skip to content

Commit

Permalink
Merge pull request #69 from pspete/dev
Browse files Browse the repository at this point in the history
Update Set-PVSafe
  • Loading branch information
pspete authored Apr 1, 2020
2 parents 768c87c + e2abca1 commit 48a04f8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 16 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file.

## [2.1.27] - 2020-04-01

- `Set-PVSafe`
- Parameter `safeOptions` updated to use Enum
- Accepts values:
- `PartiallyImpersonatedUsers` (Enable access to partially impersonated users)
- `FullyImpersonatedUsers` (Enable access to fully impersonated users)
- `ImpersonatedUsers` (Enable access to impersonated users with additional Vault authentication)
- `EnforceSafeOpening` (Enforce Safe opening from PrivateArk Client)
- Parameter `securityLevelParm` updated to use Enum
- Accepts values:
- Locations: `Internal`, `External`, `Public`.
- Security Areas: `HighlySecured`, `Secured`, `Unsecured`

## [2.0.24] - 2020-02-29

- Fix issue where exception is generated if `sessionID` value is not specified for `Start-PVPacli`.
Expand Down
37 changes: 24 additions & 13 deletions PoShPACLI/Functions/Safes/Set-PVSafe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@
a filtered Safe.
.PARAMETER safeOptions
This parameter enables to Safe to be shared with the following values or
combination of them:
64 – Enable access to partially impersonated users
128 – Enable access to fully impersonated users
512 – Enable access to impersonated users with additional Vault authentication
256 – Enforce Safe opening.
Note: This is combined with a value of 64 in order to allow access to partially
impersonated users.
This parameter enables to Safe to be shared with any combination of the following values:
PartiallyImpersonatedUsers (Enable access to partially impersonated users)
FullyImpersonatedUsers (Enable access to fully impersonated users)
ImpersonatedUsers (Enable access to impersonated users with additional Vault authentication)
EnforceSafeOpening (Enforce Safe opening from PrivateArk Client)
.PARAMETER securityLevelParm
The level of the Network Area security flags
Specify the Network Area security flags.
Valid values are combinations of the following:
Locations: Internal, External, Public.
Security Areas: HighlySecured, Secured, Unsecured
.PARAMETER ConfirmationType
The type of confirmation required to enable access to the Safe.
Expand Down Expand Up @@ -145,6 +145,11 @@
Sets size of 100Mb on DEV safe
.EXAMPLE
Set-PVSafe -safe SomeSafe -securityLevelParm Internal, HighlySecured -safeOptions FullyImpersonatedUsers, ImpersonatedUsers, PartiallyImpersonatedUsers
Update safe "SomeSafe" with declared security flags & Safe sharing options.
.NOTES
AUTHOR: Pete Maan
Expand Down Expand Up @@ -229,14 +234,12 @@
[Parameter(
Mandatory = $False,
ValueFromPipelineByPropertyName = $True)]
[ValidateSet("64", "128", "512", "256", "192", "576", "320",
"640", "384", "768", "704", "448", "832", "896", "960")]
[int]$safeOptions,
[SafeOptions]$safeOptions,

[Parameter(
Mandatory = $False,
ValueFromPipelineByPropertyName = $True)]
[int]$securityLevelParm,
[SecurityLevel]$securityLevelParm,

[Parameter(
Mandatory = $False,
Expand Down Expand Up @@ -308,6 +311,14 @@

PROCESS {

Switch ([array]$PSBoundParameters.Keys) {

{ $_ -Contains "securityLevelParm" } { $PSBoundParameters["securityLevelParm"] = [int]$securityLevelParm; continue }

{ $_ -Contains "safeOptions" } { $PSBoundParameters["safeOptions"] = [int]$safeOptions; continue }

}

$Null = Invoke-PACLICommand $Script:PV.ClientPath UPDATESAFE $($PSBoundParameters |
ConvertTo-ParameterString -donotQuote size, fromHour, toHour, delay, dailyVersions,
monthlyVersions, yearlyVersions, logRetention, fileRetention, requestsRetention,
Expand Down
28 changes: 26 additions & 2 deletions Tests/Set-PVSafe.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Describe $FunctionName {
BeforeEach {

$InputObj = [PSCustomObject]@{


safe = "SomeSafe"
}

Expand Down Expand Up @@ -72,6 +72,30 @@ Describe $FunctionName {

}

It "tranlates expected safeOptions enum value" {

Set-PVSafe -safe "SomeSafe" -safeOptions EnforceSafeOpening, FullyImpersonatedUsers, ImpersonatedUsers, PartiallyImpersonatedUsers, EnforceSafeOpening

Assert-MockCalled Invoke-PACLICommand -Times 1 -Exactly -Scope It -ParameterFilter {

$CommandParameters -match "safeOptions=960"

}

}

It "tranlates expected securityLevelParm enum value" {

Set-PVSafe -safe "SomeSafe" -securityLevelParm Internal, HighlySecured

Assert-MockCalled Invoke-PACLICommand -Times 1 -Exactly -Scope It -ParameterFilter {

$CommandParameters -match "securityLevelParm=9"

}

}

}

}
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# version format
version: 2.0.{build}
version: 2.1.{build}

environment:
#GIT_TRACE: 1
Expand Down

0 comments on commit 48a04f8

Please sign in to comment.