Skip to content

Commit 22c11c4

Browse files
committed
fix user submissions
1 parent 67434b7 commit 22c11c4

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardUserSubmissions.ps1

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,54 +39,54 @@ function Invoke-CIPPStandardUserSubmissions {
3939
if ($Settings.remediate -eq $true -or $Settings.alert -eq $true) {
4040
if (!($state -eq 'enable' -or $state -eq 'disable')) {
4141
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'UserSubmissions: Invalid state parameter set' -sev Error
42-
Return
42+
return
4343
}
4444

4545
if (!([string]::IsNullOrWhiteSpace($Settings.email))) {
4646
if ($Settings.email -notmatch '@') {
4747
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'UserSubmissions: Invalid Email parameter set' -sev Error
48-
Return
48+
return
4949
}
5050
}
5151
}
5252

5353
$PolicyState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-ReportSubmissionPolicy'
5454
$RuleState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-ReportSubmissionRule'
5555

56-
if ($Settings.state -eq 'enable') {
56+
if ($state -eq 'enable') {
5757
if (([string]::IsNullOrWhiteSpace($Settings.email))) {
5858
$PolicyIsCorrect = ($PolicyState.EnableReportToMicrosoft -eq $true) -and
59-
($PolicyState.ReportJunkToCustomizedAddress -eq $false) -and
60-
($PolicyState.ReportNotJunkToCustomizedAddress -eq $false) -and
61-
($PolicyState.ReportPhishToCustomizedAddress -eq $false)
59+
($PolicyState.ReportJunkToCustomizedAddress -eq $false) -and
60+
($PolicyState.ReportNotJunkToCustomizedAddress -eq $false) -and
61+
($PolicyState.ReportPhishToCustomizedAddress -eq $false)
6262
$RuleIsCorrect = $true
6363
} else {
6464
$PolicyIsCorrect = ($PolicyState.EnableReportToMicrosoft -eq $true) -and
65-
($PolicyState.ReportJunkToCustomizedAddress -eq $true) -and
66-
($PolicyState.ReportJunkAddresses -eq $Settings.email) -and
67-
($PolicyState.ReportNotJunkToCustomizedAddress -eq $true) -and
68-
($PolicyState.ReportNotJunkAddresses -eq $Settings.email) -and
69-
($PolicyState.ReportPhishToCustomizedAddress -eq $true) -and
70-
($PolicyState.ReportPhishAddresses -eq $Settings.email)
65+
($PolicyState.ReportJunkToCustomizedAddress -eq $true) -and
66+
($PolicyState.ReportJunkAddresses -eq $Settings.email) -and
67+
($PolicyState.ReportNotJunkToCustomizedAddress -eq $true) -and
68+
($PolicyState.ReportNotJunkAddresses -eq $Settings.email) -and
69+
($PolicyState.ReportPhishToCustomizedAddress -eq $true) -and
70+
($PolicyState.ReportPhishAddresses -eq $Settings.email)
7171
$RuleIsCorrect = ($RuleState.State -eq 'Enabled') -and
72-
($RuleState.SentTo -eq $Settings.email)
72+
($RuleState.SentTo -eq $Settings.email)
7373
}
7474
} else {
7575
if ($PolicyState.length -eq 0) {
7676
$PolicyIsCorrect = $true
7777
$RuleIsCorrect = $true
7878
} else {
7979
$PolicyIsCorrect = ($PolicyState.EnableReportToMicrosoft -eq $false) -and
80-
($PolicyState.ReportJunkToCustomizedAddress -eq $false) -and
81-
($PolicyState.ReportNotJunkToCustomizedAddress -eq $false) -and
82-
($PolicyState.ReportPhishToCustomizedAddress -eq $false)
80+
($PolicyState.ReportJunkToCustomizedAddress -eq $false) -and
81+
($PolicyState.ReportNotJunkToCustomizedAddress -eq $false) -and
82+
($PolicyState.ReportPhishToCustomizedAddress -eq $false)
8383
$RuleIsCorrect = $true
8484
}
8585
}
8686

8787
$StateIsCorrect = $PolicyIsCorrect -and $RuleIsCorrect
8888

89-
If ($Settings.remediate -eq $true) {
89+
if ($Settings.remediate -eq $true) {
9090

9191
# If policy is set correctly, log and skip setting the policy
9292
if ($StateIsCorrect -eq $true) {
@@ -176,10 +176,10 @@ function Invoke-CIPPStandardUserSubmissions {
176176
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'User Submission policy is properly configured.' -sev Info
177177
} else {
178178
if ($Policy.EnableReportToMicrosoft -eq $true) {
179-
Write-StandardsAlert -message "User Submission policy is enabled but incorrectly configured" -object $PolicyState -tenant $Tenant -standardName 'UserSubmissions' -standardId $Settings.standardId
179+
Write-StandardsAlert -message 'User Submission policy is enabled but incorrectly configured' -object $PolicyState -tenant $Tenant -standardName 'UserSubmissions' -standardId $Settings.standardId
180180
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'User Submission policy is enabled but incorrectly configured' -sev Info
181181
} else {
182-
Write-StandardsAlert -message "User Submission policy is disabled." -object $PolicyState -tenant $Tenant -standardName 'UserSubmissions' -standardId $Settings.standardId
182+
Write-StandardsAlert -message 'User Submission policy is disabled.' -object $PolicyState -tenant $Tenant -standardName 'UserSubmissions' -standardId $Settings.standardId
183183
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'User Submission policy is disabled.' -sev Info
184184
}
185185
}

0 commit comments

Comments
 (0)