Skip to content

Commit

Permalink
Merge pull request #1170 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
JohnDuprey authored Nov 4, 2024
2 parents 9d0ae17 + 5178681 commit b713768
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ function Get-CIPPStandards {
param(
[Parameter(Mandatory = $false)]
[string]$TenantFilter = 'allTenants',
[switch]$ListAllTenants
[switch]$ListAllTenants,
[switch]$SkipGetTenants
)

#Write-Host "Getting standards for tenant - $($tenantFilter)"
Expand All @@ -12,7 +13,12 @@ function Get-CIPPStandards {
$StandardsAllTenants = $Standards | Where-Object { $_.Tenant -eq 'AllTenants' }

# Get tenant list based on filter
$Tenants = Get-Tenants
if ($SkipGetTenants.IsPresent) {
# Debugging flag to skip Get-Tenants
$Tenants = $Standards.Tenant | Sort-Object -Unique | ForEach-Object { [pscustomobject]@{ defaultDomainName = $_ } }
} else {
$Tenants = Get-Tenants
}
if ($TenantFilter -ne 'allTenants') {
$Tenants = $Tenants | Where-Object { $_.defaultDomainName -eq $TenantFilter -or $_.customerId -eq $TenantFilter }
}
Expand Down Expand Up @@ -63,8 +69,7 @@ function Get-CIPPStandards {
$ComputedStandards[$StandardName] = $CurrentStandard
} else {
foreach ($Setting in $CurrentStandard.PSObject.Properties.Name) {
# Write-Host "$Setting - Current: $($CurrentStandard.$Setting) | Computed: $($ComputedStandards[$StandardName].$($Setting))"
if ($CurrentStandard.$Setting -ne $false -and ($CurrentStandard.$Setting -ne $ComputedStandards[$StandardName].$($Setting) -and ![string]::IsNullOrWhiteSpace($CurrentStandard.$Setting -or (Compare-Object $CurrentStandard.$Setting $ComputedStandards[$StandardName].$($Setting))))) {
if ($CurrentStandard.$Setting -ne $false -and ($CurrentStandard.$Setting -ne $ComputedStandards[$StandardName].$($Setting) -and ![string]::IsNullOrWhiteSpace($CurrentStandard.$Setting) -or ($null -ne $CurrentStandard.$Setting -and $null -ne $ComputedStandards[$StandardName].$($Setting) -and (Compare-Object $CurrentStandard.$Setting $ComputedStandards[$StandardName].$($Setting))))) {
#Write-Host "Overriding $Setting for $StandardName at tenant level"
if ($ComputedStandards[$StandardName].PSObject.Properties.Name -contains $Setting) {
$ComputedStandards[$StandardName].$($Setting) = $CurrentStandard.$Setting
Expand Down

0 comments on commit b713768

Please sign in to comment.