forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from KelvinTegelaar/master
[pull] master from KelvinTegelaar:master
- Loading branch information
Showing
14 changed files
with
238 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...s/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions/Invoke-ListExtensionSync.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using namespace System.Net | ||
|
||
Function Invoke-ListExtensionSync { | ||
<# | ||
.FUNCTIONALITY | ||
Entrypoint | ||
.ROLE | ||
CIPP.Extension.Read | ||
#> | ||
[CmdletBinding()] | ||
param($Request, $TriggerMetadata) | ||
|
||
$APIName = $TriggerMetadata.FunctionName | ||
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug' | ||
|
||
# Write to the Azure Functions log stream. | ||
Write-Host 'PowerShell HTTP trigger function processed a request.' | ||
$ScheduledTasksTable = Get-CIPPTable -TableName 'ScheduledTasks' | ||
$ScheduledTasks = Get-CIPPAzDataTableEntity @ScheduledTasksTable -Filter 'Hidden eq true' | Where-Object { $_.Command -match 'CippExtension' } | ||
|
||
$AllowedTenants = Test-CIPPAccess -Request $Request -TenantList | ||
$TenantList = Get-Tenants -IncludeErrors | ||
$AllTasksArrayList = [system.collections.generic.list[object]]::new() | ||
|
||
foreach ($Task in $ScheduledTasks) { | ||
if ($Task.Results -and (Test-Json -Json $Task.Results -ErrorAction SilentlyContinue)) { | ||
$Results = $Task.Results | ConvertFrom-Json | ||
} else { | ||
$Results = $Task.Results | ||
} | ||
|
||
$TaskEntry = [PSCustomObject]@{ | ||
RowKey = $Task.RowKey | ||
PartitionKey = $Task.PartitionKey | ||
Tenant = $Task.Tenant | ||
Name = $Task.Name | ||
SyncType = $Task.SyncType | ||
ScheduledTime = $Task.ScheduledTime | ||
ExecutedTime = $Task.ExecutedTime | ||
RepeatsEvery = $Task.Recurrence | ||
Results = $Results | ||
} | ||
|
||
if ($AllowedTenants -notcontains 'AllTenants') { | ||
$Tenant = $TenantList | Where-Object -Property defaultDomainName -EQ $Task.Tenant | ||
if ($AllowedTenants -contains $Tenant.customerId) { | ||
$AllTasksArrayList.Add($TaskEntry) | ||
} | ||
} else { | ||
$AllTasksArrayList.Add($TaskEntry) | ||
} | ||
} | ||
Write-Host ($AllTasksArrayList | ConvertTo-Json -Depth 5 -Compress) | ||
# Associate values to output bindings by calling 'Push-OutputBinding'. | ||
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ | ||
StatusCode = [HttpStatusCode]::OK | ||
Body = ConvertTo-Json -Depth 5 -InputObject $($AllTasksArrayList) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function Get-HuduLinkBlock($URL, $Icon, $Title) { | ||
return "<button class='button' style='background-color: var(--primary)' role='button'><a style='color: white;' role='button' href=$URL target=_blank><i class=`"$Icon me-2`" />$Title</a></button>" | ||
return '<button class="button" style="background-color: var(--primary)" role="button"><a style="color: white;" role="button" href="{0}" target="_blank"><i class="{1} me-2"></i>{2}</a></button>' -f $URL, $Icon, $Title | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.