Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to hotfix #424

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions EditGroup/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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)")
}
Expand Down Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion GetCippAlerts/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $APIVersion = Get-Content "version_latest.txt" | Out-String
$CIPPVersion = $request.query.localversion

$RemoteAPIVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP-API/master/version_latest.txt"
$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/version_latest.txt"
$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/public/version_latest.txt"

$version = [PSCustomObject]@{
LocalCIPPVersion = $CIPPVersion
Expand Down
2 changes: 1 addition & 1 deletion GetVersion/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $APIVersion = Get-Content "version_latest.txt" | Out-String
$CIPPVersion = $request.query.localversion

$RemoteAPIVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP-API/master/version_latest.txt"
$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/version_latest.txt"
$RemoteCIPPVersion = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/KelvinTegelaar/CIPP/master/public/version_latest.txt"

$version = [PSCustomObject]@{
LocalCIPPVersion = $CIPPVersion
Expand Down
2 changes: 1 addition & 1 deletion GraphHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ function Remove-CIPPCache {
function New-ExoRequest ($tenantid, $cmdlet, $cmdParams, $useSystemMailbox, $Anchor, $NoAuthCheck) {
if ((Get-AuthorisedRequest -TenantID $tenantid) -or $NoAuthCheck -eq $True) {
$token = Get-ClassicAPIToken -resource 'https://outlook.office365.com' -Tenantid $tenantid
$tenant = (get-tenants | Where-Object -Property defaultDomainName -EQ $tenantid).customerId
$tenant = (get-tenants -IncludeErrors | Where-Object -Property defaultDomainName -EQ $tenantid).customerId
if ($cmdParams) {
$Params = $cmdParams
}
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.0
4.3.1
Loading