Group Management: Benutzer-Tab mit Gruppen-Mitgliedschaften
Neuer Tab "Benutzer" im Group Management: Benutzer suchen und alle Gruppen anzeigen, in denen dieser Mitglied ist (transitiveMemberOf). Gruppen filterbar, mit Typ-Badge (Sicherheitsgruppe/M365/Verteiler). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+30
@@ -66,6 +66,10 @@ function Invoke-ApiHandler {
|
||||
return Remove-GroupMemberEndpoint -GroupId $matches[1] -UserId $matches[2]
|
||||
}
|
||||
|
||||
if ($Method -eq "GET" -and $Path -match "^/api/users/([^/]+)/memberof$") {
|
||||
return Get-UserMemberOfEndpoint -UserId $matches[1]
|
||||
}
|
||||
|
||||
if ($Method -eq "GET" -and $Path -match "^/api/apps/([^/]+)/details$") {
|
||||
return Get-AppDetailsEndpoint -AppId $matches[1]
|
||||
}
|
||||
@@ -1490,6 +1494,32 @@ function Search-UsersEndpoint {
|
||||
return @{ items = $items; count = $items.Count }
|
||||
}
|
||||
|
||||
function Get-UserMemberOfEndpoint {
|
||||
param($UserId)
|
||||
$err = Test-Connected
|
||||
if ($err) { return $err }
|
||||
|
||||
$groups = @()
|
||||
$uri = "https://graph.microsoft.com/v1.0/users/$UserId/transitiveMemberOf/microsoft.graph.group?`$select=id,displayName,description,groupTypes,mailEnabled,securityEnabled&`$top=100"
|
||||
while ($uri) {
|
||||
$resp = Invoke-MgGraphRequestRetry -Uri $uri -Method GET
|
||||
foreach ($g in $resp.value) {
|
||||
$type = 'Sicherheitsgruppe'
|
||||
if ($g.groupTypes -contains 'Unified') { $type = 'Microsoft 365' }
|
||||
elseif ($g.mailEnabled -and -not $g.securityEnabled) { $type = 'Verteiler' }
|
||||
$groups += [pscustomobject]@{
|
||||
Id = $g.id
|
||||
DisplayName = $g.displayName
|
||||
Description = $g.description
|
||||
Type = $type
|
||||
}
|
||||
}
|
||||
$uri = $resp.'@odata.nextLink'
|
||||
}
|
||||
$groups = $groups | Sort-Object DisplayName
|
||||
return @{ groups = $groups; count = $groups.Count }
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# Apps
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user