-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEntitlements.ps1
More file actions
42 lines (35 loc) · 1.34 KB
/
Entitlements.ps1
File metadata and controls
42 lines (35 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#region Configuration Data
$config = ConvertFrom-Json $configuration
$script:url = ($config.Url).TrimEnd("/")
$apiKey = $config.Apikey
$t4eGroupGuidUrl = $config.t4eGroupGuid
#endregion Configuration Data
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls10 -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
#region Functions
function Invoke-UltimoRestMethod ($EndpointUrl, $ApiKey, $body , $Proxy) {
try {
$requestUrl = "$($script:url)/$($EndpointUrl)?ApiKey=$ApiKey"
$responseRestMethod = Invoke-RestMethod -uri $requestUrl -Method POST -Body $body -Proxy:$proxy -UseBasicParsing -ContentType "application/json"
Write-Output $responseRestMethod
} catch {
throw $_.exception.message
}
}
#endregion Functions
try {
$resultGroup = (Invoke-UltimoRestMethod -EndpointUrl $t4eGroupGuidUrl -ApiKey $ApiKey).properties.data
} catch {
Write-Verbose -verbose "$($_.Exception.Message)"
}
# Group persmission formatter HelloID
$permissions = [System.Collections.Generic.List[psobject]]::new()
foreach ($g in $resultGroup) {
$permission = @{
DisplayName = $g.groupid
Identification = @{
Id = $g.groupid
}
}
$permissions.add( $permission )
}
Write-Output ($permissions | ConvertTo-Json)