functions/configurations/Get-TssConfigurationState.ps1
|
function Get-TssConfigurationState { <# .SYNOPSIS Get the configuration section access of the current user .DESCRIPTION Returns each configuration section id with the access the current user has to it: Admin, View, None or InvalidLicense. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred (Get-TssConfigurationState -TssSession $session).Sections | Where-Object SectionAccess -EQ 'Admin' List the configuration sections the current user can administer .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/configurations/Get-TssConfigurationState .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/configurations/Get-TssConfigurationState.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Configuration.State')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation $uri = $TssSession.ApiUrl, 'configuration', 'state' -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Get-TssConfigurationState request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Configuration.State](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Configuration.State])) } } else { Write-Warning 'No valid session found' } } } |