controls/identity-grid.ps1
function New-UAIdentityGrid { New-UDGrid -Id 'identity-grid' -Title "Identities" -Headers @("Id", "Name", "Role", "Actions") -Properties @("Id", "Name", "Role", "Actions") -Endpoint { Get-UAIdentity | ForEach-Object { $Identity = $_ $IdentityEditModalButton = New-UDButton -Icon user_edit -OnClick { New-UDEditIdentityModal -Identity $Identity } $IdentityDeleteModalButton = New-UDButton -Icon user_slash -OnClick { New-UARemoveIdentityModal -Identity $Identity } $IdentityGetAppTokensModalButton = New-UDButton -Icon user_slash -OnClick { New-UARemoveIdentityModal -Identity $Identity } if ($null -eq $Session:AuthorizationPolicies -or ($Session:UserRole -eq 'Administrator')) { $ActionButtons = New-UDElement -Tag div -Content { If($Identity.Name -ne "System" -and $Identity.Name -ne "admin") { New-UDTooltip -Content {$IdentityEditModalButton} -TooltipContent { "Edit the Identity" } " " New-UDTooltip -Content {$IdentityDeleteModalButton} -TooltipContent { "Delete the Identity" } } else { " " } } } else { $ActionButtons = "N/A" } [PSCustomObject]@{ Id = $Identity.Id Name = $Identity.Name Role = $Identity.Role.Name Actions = $ActionButtons } } | Out-UDGridData } } |