Skip to content

Commit 4f53a8c

Browse files
authored
Merge pull request #200 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 30527e9 + 8a6c50d commit 4f53a8c

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ExecOnboardTenantQueue.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ Function Push-ExecOnboardTenantQueue {
233233
$Logs.Add([PSCustomObject]@{ Date = (Get-Date).ToUniversalTime(); Log = 'Checking for missing groups for SAM user' })
234234
$SamUserId = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/me?`$select=id" -NoAuthCheck $true).id
235235
$CurrentMemberships = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/me/transitiveMemberOf?`$select=id,displayName" -NoAuthCheck $true
236-
foreach ($Role in $Item.Roles) {
236+
$ExpectedCippRoles = $Item.Roles | Where-Object { $_.roleDefinitionId -in $ExpectedRoles.roleDefinitionId }
237+
foreach ($Role in $ExpectedCippRoles) {
237238
if ($CurrentMemberships.id -notcontains $Role.GroupId) {
238239
$PostBody = @{
239240
'@odata.id' = 'https://graph.microsoft.com/v1.0/directoryObjects/{0}' -f $SamUserId

Modules/CIPPCore/Public/Entrypoints/Invoke-ExecExtensionNinjaOneQueue.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,13 @@ Function Invoke-ExecExtensionNinjaOneQueue {
1818
'SyncTenant' { Invoke-NinjaOneTenantSync -QueueItem $QueueItem }
1919
}
2020

21+
$Body = [PSCustomObject]@{
22+
StatusCode = [HttpStatusCode]::OK
23+
Body = 'Success'
24+
}
25+
26+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
27+
StatusCode = [HttpStatusCode]::OK
28+
Body = $Body
29+
})
2130
}

Modules/CIPPCore/Public/Get-CIPPTextReplacement.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function Get-CIPPTextReplacement {
1818
if ($Text -isnot [string]) {
1919
return $Text
2020
}
21-
$blacklist = @(
21+
22+
$ReservedVariables = @(
2223
'%serial%',
2324
'%systemroot%',
2425
'%systemdrive%',
@@ -27,8 +28,16 @@ function Get-CIPPTextReplacement {
2728
'%tenantfilter%',
2829
'%tenantname%',
2930
'%partnertenantid%',
30-
'%samappid%'
31+
'%samappid%',
32+
'%userprofile%',
33+
'%username%',
34+
'%userdomain%',
35+
'%windir%',
36+
'%programfiles%',
37+
'%programfiles(x86)%',
38+
'%programdata%'
3139
)
40+
3241
$Tenant = Get-Tenants -TenantFilter $TenantFilter
3342
$CustomerId = $Tenant.customerId
3443

@@ -54,7 +63,7 @@ function Get-CIPPTextReplacement {
5463
# Replace custom variables
5564
foreach ($Replace in $Vars.GetEnumerator()) {
5665
$String = '%{0}%' -f $Replace.Key
57-
if ($string -notin $blacklist) {
66+
if ($string -notin $ReservedVariables) {
5867
$Text = $Text -replace $String, $Replace.Value
5968
}
6069
}

Modules/CIPPCore/Public/New-CIPPApplicationCopy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function New-CIPPApplicationCopy {
2222
$ExistingAppRoleAssignments = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals(appId='$($app)')/appRoleAssignments" -tenantid $env:TenantID -NoAuthCheck $true -AsApp $true
2323
$Type = 'ServicePrincipal'
2424
}
25-
if (!$ExistingApp) {
26-
Write-LogMessage -message "Failed to add $App to tenant. This app does not exist." -tenant $tenant -API 'Application Copy' -sev error
25+
if (!$ExistingApp -and !$ExistingAppRoleAssignments) {
26+
Write-LogMessage -message "Failed to add $App to tenant. This app does not exist or does not have any consented permissions." -tenant $tenant -API 'Application Copy' -sev error
2727
continue
2828
}
2929
if ($Type -eq 'Application') {

Modules/CippExtensions/Public/NinjaOne/Invoke-NinjaOneTenantSync.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,4 +2141,5 @@ function Invoke-NinjaOneTenantSync {
21412141
$CurrentItem | Add-Member -NotePropertyName lastStatus -NotePropertyValue 'Failed' -Force
21422142
Add-CIPPAzDataTableEntity @MappingTable -Entity $CurrentItem -Force
21432143
}
2144+
return $true
21442145
}

Modules/CippExtensions/Public/NinjaOne/Push-NinjaOneQueue.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ function Push-NinjaOneQueue {
1111
'SyncTenant' { Invoke-NinjaOneTenantSync -QueueItem $Item }
1212
'SyncTenants' { Invoke-NinjaOneSync }
1313
}
14-
15-
}
14+
return $true
15+
}

0 commit comments

Comments
 (0)