Skip to content

Commit bf2e598

Browse files
authored
Merge pull request #332 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 20facb3 + 17c489e commit bf2e598

File tree

8 files changed

+49
-19
lines changed

8 files changed

+49
-19
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,29 @@ function Invoke-ListScheduledItems {
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

17-
18-
# Interact with query parameters or the body of the request.
19-
$ShowHidden = $Request.Query.ShowHidden ?? $Request.Body.ShowHidden
20-
$Name = $Request.Query.Name ?? $Request.Body.Name
21-
$Type = $Request.Query.Type ?? $Request.Body.Type
22-
2317
$ScheduledItemFilter = [System.Collections.Generic.List[string]]::new()
2418
$ScheduledItemFilter.Add("PartitionKey eq 'ScheduledTask'")
2519

26-
if ($ShowHidden -eq $true) {
27-
$ScheduledItemFilter.Add('Hidden eq true')
20+
$Id = $Request.Query.Id ?? $Request.Body.Id
21+
if ($Id) {
22+
# Interact with query parameters.
23+
$ScheduledItemFilter.Add("RowKey eq '$($Id)'")
2824
} else {
29-
$ScheduledItemFilter.Add('Hidden eq false')
30-
}
25+
# Interact with query parameters or the body of the request.
26+
$ShowHidden = $Request.Query.ShowHidden ?? $Request.Body.ShowHidden
27+
$Name = $Request.Query.Name ?? $Request.Body.Name
28+
$Type = $Request.Query.Type ?? $Request.Body.Type
29+
30+
if ($ShowHidden -eq $true) {
31+
$ScheduledItemFilter.Add('Hidden eq true')
32+
} else {
33+
$ScheduledItemFilter.Add('Hidden eq false')
34+
}
35+
36+
if ($Name) {
37+
$ScheduledItemFilter.Add("Name eq '$($Name)'")
38+
}
3139

32-
if ($Name) {
33-
$ScheduledItemFilter.Add("Name eq '$($Name)'")
3440
}
3541

3642
$Filter = $ScheduledItemFilter -join ' and '
@@ -42,7 +48,7 @@ function Invoke-ListScheduledItems {
4248
} else {
4349
$HiddenTasks = $true
4450
}
45-
$Tasks = Get-CIPPAzDataTableEntity @Table -Filter $Filter | Where-Object { $_.Hidden -ne $HiddenTasks }
51+
$Tasks = Get-CIPPAzDataTableEntity @Table -Filter $Filter
4652
if ($Type) {
4753
$Tasks = $Tasks | Where-Object { $_.command -eq $Type }
4854
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-AddUserBulk.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function Invoke-AddUserBulk {
131131
if ($AssignedLicenses) {
132132
$GuidPattern = '([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})'
133133
$LicenseSkus = $AssignedLicenses.value ?? $AssignedLicenses | Where-Object { $_ -match $GuidPattern }
134-
Set-CIPPUserLicense -User $BulkResult.id -AddLicenses $LicenseSkus -TenantFilter $TenantFilter
134+
Set-CIPPUserLicense -UserId $BulkResult.id -AddLicenses $LicenseSkus -TenantFilter $TenantFilter
135135
}
136136
$Results.Add(@{
137137
resultText = $Message.resultText

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-EditUser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function Invoke-EditUser {
9898
value = 'Set-CIPPUserLicense'
9999
}
100100
Parameters = [pscustomobject]@{
101-
userId = $UserObj.id
101+
UserId = $UserObj.id
102102
APIName = 'Sherweb License Assignment'
103103
AddLicenses = $licenses
104104
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-EditCAPolicy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Function Invoke-EditCAPolicy {
3232
$properties["displayName"] = $DisplayName
3333
}
3434

35-
$Request = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta//identity/conditionalAccess/policies/$($ID)" -tenantid $TenantFilter -type PATCH -body ($properties | ConvertTo-Json) -asapp $true
35+
$Request = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$($ID)" -tenantid $TenantFilter -type PATCH -body ($properties | ConvertTo-Json) -asapp $true
3636

3737
$Result = "Successfully updated CA policy $($ID)"
3838
if ($State) { $Result += " state to $($State)" }

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ function Invoke-AddStandardsTemplate {
3030
PartitionKey = 'StandardsTemplateV2'
3131
GUID = "$GUID"
3232
}
33+
34+
$AddObject = @{
35+
PartitionKey = 'InstanceProperties'
36+
RowKey = 'CIPPURL'
37+
Value = [string]([System.Uri]$Headers.'x-ms-original-url').Host
38+
}
39+
$ConfigTable = Get-CIPPTable -tablename 'Config'
40+
Add-AzDataTableEntity @ConfigTable -Entity $AddObject -Force
41+
3342
Write-LogMessage -headers $Request.Headers -API $APINAME -message "Standards Template $($Request.body.templateName) with GUID $GUID added/edited." -Sev 'Info'
3443
$body = [pscustomobject]@{'Results' = 'Successfully added template'; Metadata = @{id = $GUID } }
3544

Modules/CIPPCore/Public/New-CIPPUserTask.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function New-CIPPUserTask {
3030
value = 'Set-CIPPUserLicense'
3131
}
3232
Parameters = [pscustomobject]@{
33-
userId = $UserObj.id
33+
UserId = $UserObj.id
3434
APIName = 'Sherweb License Assignment'
3535
AddLicenses = $licenses
3636
}

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,33 @@ function Invoke-CIPPStandardPhishProtection {
3535

3636
$TenantId = Get-Tenants | Where-Object -Property defaultDomainName -EQ $tenant
3737

38+
$Table = Get-CIPPTable -TableName Config
39+
$CippConfig = (Get-CIPPAzDataTableEntity @Table)
40+
$CIPPUrl = ($CippConfig | Where-Object { $_.RowKey -eq 'CIPPURL' }).Value
41+
3842
try {
3943
$currentBody = (New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/organization/$($TenantId.customerId)/branding/localizations/0/customCSS" -tenantid $tenant)
4044
} catch {
4145
Write-LogMessage -API 'Standards' -tenant $tenant -message "Could not get the branding for $($Tenant). This tenant might not have premium licenses available: $($_.Exception.Message)" -sev Error
4246
}
4347
$CSS = @"
4448
.ext-sign-in-box {
45-
background-image: url(https://clone.cipp.app/api/PublicPhishingCheck?Tenantid=$($tenant)&URL=$($Settings.URL));
49+
background-image: url(https://clone.cipp.app/api/PublicPhishingCheck?Tenantid=$($tenant)&URL=https://$($CIPPUrl));
4650
}
4751
"@
4852
if ($Settings.remediate -eq $true) {
4953

54+
$malformedCSSPattern = '\.ext-sign-in-box\s*\{\s*background-image:\s*url\(https://clone\.cipp\.app/api/PublicPhishingCheck\?Tenantid=[^&]*&URL=\);\s*\}'
55+
if ($currentBody -match $malformedCSSPattern) {
56+
if ($Settings.remediate -eq $true) {
57+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Attempting to fix malformed PhishProtection CSS by removing the problematic pattern' -sev Info
58+
# Remove the malformed CSS pattern
59+
$currentBody = $currentBody -replace $malformedCSSPattern, ''
60+
# Clean up any duplicate .ext-sign-in-box entries
61+
#$currentBody = $currentBody -replace '\.ext-sign-in-box\s*\{[^}]*\}\s*\.ext-sign-in-box', '.ext-sign-in-box'
62+
}
63+
}
64+
5065
try {
5166
if (!$currentBody) {
5267
$AddedHeaders = @{'Accept-Language' = 0 }

version_latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.1.0
1+
8.1.1

0 commit comments

Comments
 (0)