fix: 1.3.6 aligned with test-template

This commit is contained in:
DrIOS
2024-05-28 10:05:35 -05:00
parent 283b278524
commit fbe22abe9c

View File

@@ -1,19 +1,39 @@
function Test-CustomerLockbox { function Test-CustomerLockbox {
[CmdletBinding()] [CmdletBinding()]
param ( param (
# Define your parameters here # Aligned
# Define your parameters here if needed
) )
begin { begin {
# Dot source the class script if necessary
$auditResults = @() # Initialization code, if needed
} }
process { process {
# 1.3.6 (L2) Ensure the customer lockbox feature is enabled # 1.3.6 (L2) Ensure the customer lockbox feature is enabled
# Retrieve the organization configuration
$orgConfig = Get-OrganizationConfig | Select-Object CustomerLockBoxEnabled $orgConfig = Get-OrganizationConfig | Select-Object CustomerLockBoxEnabled
$customerLockboxEnabled = $orgConfig.CustomerLockBoxEnabled $customerLockboxEnabled = $orgConfig.CustomerLockBoxEnabled
# Prepare failure reasons and details based on compliance
$failureReasons = if (-not $customerLockboxEnabled) {
"Customer lockbox feature is not enabled."
}
else {
"N/A"
}
$details = if ($customerLockboxEnabled) {
"Customer Lockbox Enabled: True"
}
else {
"Customer Lockbox Enabled: False"
}
# Create and populate the CISAuditResult object
$auditResult = [CISAuditResult]::new() $auditResult = [CISAuditResult]::new()
$auditResult.Status = if ($customerLockboxEnabled) { "Pass" } else { "Fail" } $auditResult.Status = if ($customerLockboxEnabled) { "Pass" } else { "Fail" }
$auditResult.ELevel = "E5" $auditResult.ELevel = "E5"
@@ -27,14 +47,12 @@ function Test-CustomerLockbox {
$auditResult.IG2 = $false $auditResult.IG2 = $false
$auditResult.IG3 = $false $auditResult.IG3 = $false
$auditResult.Result = $customerLockboxEnabled $auditResult.Result = $customerLockboxEnabled
$auditResult.Details = "Customer Lockbox Enabled: $customerLockboxEnabled" $auditResult.Details = $details
$auditResult.FailureReason = if ($customerLockboxEnabled) { "N/A" } else { "Customer lockbox feature is not enabled." } $auditResult.FailureReason = $failureReasons
$auditResults += $auditResult
} }
end { end {
# Return auditResults # Return the audit result
return $auditResults return $auditResult
} }
} }