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 remote-tracking branch 'upstream/master'
- Loading branch information
Showing
42 changed files
with
740 additions
and
382 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
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,12 @@ | ||
{ | ||
"scriptFile": "../Modules/CippEntryPoints/CippEntryPoints.psm1", | ||
"entryPoint": "Receive-CippQueueTrigger", | ||
"bindings": [ | ||
{ | ||
"name": "QueueItem", | ||
"type": "queueTrigger", | ||
"direction": "in", | ||
"queueName": "AlertSubscriptions" | ||
} | ||
] | ||
} |
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
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
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
36 changes: 18 additions & 18 deletions
36
AddScheduledItems/function.json → AddScheduledItem/function.json
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,19 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "anonymous", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "Request", | ||
"methods": [ | ||
"get", | ||
"post" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "Response" | ||
} | ||
] | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "anonymous", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "Request", | ||
"methods": [ | ||
"get", | ||
"post" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "Response" | ||
} | ||
] | ||
} |
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,30 @@ | ||
using namespace System.Net | ||
param($Request, $TriggerMetadata) | ||
$APIName = $TriggerMetadata.FunctionName | ||
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug' | ||
$task = $Request.Body | ||
$Table = Get-CIPPTable -TableName 'ScheduledTasks' | ||
|
||
$propertiesToCheck = @('Webhook', 'Email', 'PSA') | ||
$PostExecution = ($propertiesToCheck | Where-Object { $task.PostExecution.$_ -eq $true }) -join ',' | ||
$Parameters = ($task.Parameters | ConvertTo-Json -Compress) | ||
if ($Parameters -eq 'null') { $Parameters = '' } | ||
$entity = @{ | ||
PartitionKey = [string]'ScheduledTask' | ||
TaskState = [string]'Planned' | ||
RowKey = [string]"$(New-Guid)" | ||
Tenant = [string]$task.TenantFilter | ||
Name = [string]$task.Name | ||
Command = [string]$task.Command.value | ||
Parameters = [string]$Parameters | ||
ScheduledTime = [string]$task.ScheduledTime | ||
Recurrence = [string]$task.Recurrence.value | ||
PostExecution = [string]$PostExecution | ||
Results = 'Planned' | ||
} | ||
Write-Host "entity: $($entity | ConvertTo-Json)" | ||
Add-AzDataTableEntity @Table -Entity $entity | ||
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ | ||
StatusCode = [HttpStatusCode]::OK | ||
Body = @{ Results = 'Task added successfully.' } | ||
}) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -18,7 +18,8 @@ if ($AddMembers) { | |
$AddMembers | ForEach-Object { | ||
try { | ||
$member = $_ | ||
$MemberIDs = "https://graph.microsoft.com/v1.0/directoryObjects/" + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($_)" -tenantid $Userobj.tenantid).id | ||
if ($member -like '*#EXT#*') { $member = [System.Web.HttpUtility]::UrlEncode($member) } | ||
$MemberIDs = "https://graph.microsoft.com/v1.0/directoryObjects/" + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($member)" -tenantid $Userobj.tenantid).id | ||
$addmemberbody = "{ `"[email protected]`": $(ConvertTo-Json @($MemberIDs)) }" | ||
if ($userobj.groupType -eq "Distribution list" -or $userobj.groupType -eq "Mail-Enabled Security") { | ||
$Params = @{ Identity = $userobj.groupid; Member = $member; BypassSecurityGroupManagerCheck = $true } | ||
|
@@ -47,11 +48,12 @@ if ($AddContacts) { | |
New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-DistributionGroupMember" -cmdParams $params -UseSystemMailbox $true | ||
Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "Added $member to $($userobj.groupid) group" -Sev "Info" | ||
$body = $results.add("Success. $member has been added") | ||
} else { | ||
Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "You cannot add a contact to a security group" -Sev "Error" | ||
$body = $results.add("You cannot add a contact to a security group") | ||
} | ||
else { | ||
Write-LogMessage -API $APINAME -tenant $Userobj.tenantid -user $request.headers.'x-ms-client-principal' -message "You cannot add a contact to a security group" -Sev "Error" | ||
$body = $results.add("You cannot add a contact to a security group") | ||
} | ||
} | ||
} | ||
catch { | ||
$body = $results.add("Failed to add member $member to $($userobj.Groupid): $($_.Exception.Message)") | ||
} | ||
|
@@ -149,16 +151,16 @@ if ($userobj.allowExternal -eq 'true') { | |
|
||
if ($userobj.sendCopies -eq 'true') { | ||
try { | ||
$Params = @{ Identity = $userobj.Groupid; subscriptionEnabled = $true; AutoSubscribeNewMembers = $true } | ||
New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Set-UnifiedGroup" -cmdParams $params -useSystemMailbox $true | ||
$Params = @{ Identity = $userobj.Groupid; subscriptionEnabled = $true; AutoSubscribeNewMembers = $true } | ||
New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Set-UnifiedGroup" -cmdParams $params -useSystemMailbox $true | ||
|
||
$MemberParams = @{ Identity = $userobj.Groupid; LinkType = "members" } | ||
$Members = New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Get-UnifiedGrouplinks" -cmdParams $MemberParams | ||
$MemberParams = @{ Identity = $userobj.Groupid; LinkType = "members" } | ||
$Members = New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Get-UnifiedGrouplinks" -cmdParams $MemberParams | ||
|
||
$MemberSmtpAddresses = $Members | ForEach-Object { $_.PrimarySmtpAddress } | ||
$MemberSmtpAddresses = $Members | ForEach-Object { $_.PrimarySmtpAddress } | ||
|
||
$subscriberParams = @{ Identity = $userobj.Groupid; LinkType = "subscribers"; Links = @($MemberSmtpAddresses) } | ||
New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-UnifiedGrouplinks" -cmdParams $subscriberParams -Anchor $userobj.mail | ||
$subscriberParams = @{ Identity = $userobj.Groupid; LinkType = "subscribers"; Links = @($MemberSmtpAddresses) } | ||
New-ExoRequest -tenantid $Userobj.tenantid -cmdlet "Add-UnifiedGrouplinks" -cmdParams $subscriberParams -Anchor $userobj.mail | ||
|
||
|
||
$body = $results.add("Send Copies of team emails and events to team members inboxes for $($userobj.mail) enabled.") | ||
|
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.