change: Get-Action Testing

This commit is contained in:
DrIOS
2024-07-07 11:58:16 -05:00
parent ff1162f962
commit fcaebf1db1

View File

@@ -11,6 +11,12 @@ function Get-Action {
[ValidateSet("Admin", "Delegate", "Owner")] [ValidateSet("Admin", "Delegate", "Owner")]
[string]$ActionType, [string]$ActionType,
[Parameter(Position = 2, Mandatory = $true, ParameterSetName = "ConvertActions")]
[Parameter(Position = 2, Mandatory = $true, ParameterSetName = "ReverseActions")]
[Parameter(Position = 1, Mandatory = $true, ParameterSetName = "GetDictionaries")]
[ValidateSet("6.1.2", "6.1.3")]
[string]$Version = "6.1.2",
[Parameter(Position = 0, ParameterSetName = "ReverseActions")] [Parameter(Position = 0, ParameterSetName = "ReverseActions")]
[string[]]$AbbreviatedActions, [string[]]$AbbreviatedActions,
@@ -20,6 +26,52 @@ function Get-Action {
) )
$Dictionary = @{ $Dictionary = @{
"6.1.2" = @{
AdminActions = @{
ApplyRecord = 'AR'
Copy = 'CP'
Create = 'CR'
FolderBind = 'FB'
HardDelete = 'HD'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SendAs = 'SA'
SendOnBehalf = 'SOB'
SoftDelete = 'SD'
Update = 'UP'
UpdateCalendarDelegation = 'UCD'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
DelegateActions = @{
ApplyRecord = 'AR'
Create = 'CR'
FolderBind = 'FB'
HardDelete = 'HD'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SendAs = 'SA'
SendOnBehalf = 'SOB'
SoftDelete = 'SD'
Update = 'UP'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
OwnerActions = @{
ApplyRecord = 'AR'
Create = 'CR'
HardDelete = 'HD'
MailboxLogin = 'ML'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
SoftDelete = 'SD'
Update = 'UP'
UpdateCalendarDelegation = 'UCD'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
}
"6.1.3" = @{
AdminActions = @{ AdminActions = @{
ApplyRecord = 'AR' ApplyRecord = 'AR'
Copy = 'CP' Copy = 'CP'
@@ -69,13 +121,15 @@ function Get-Action {
UpdateInboxRules = 'UIR' UpdateInboxRules = 'UIR'
} }
} }
}
switch ($PSCmdlet.ParameterSetName) { switch ($PSCmdlet.ParameterSetName) {
"GetDictionaries" { "GetDictionaries" {
return $Dictionary return $Dictionary[$Version]
} }
"ConvertActions" { "ConvertActions" {
try { try {
$Dictionary = $Dictionary[$Version]
$actionDictionary = switch ($ActionType) { $actionDictionary = switch ($ActionType) {
"Admin" { $Dictionary.AdminActions } "Admin" { $Dictionary.AdminActions }
"Delegate" { $Dictionary.DelegateActions } "Delegate" { $Dictionary.DelegateActions }
@@ -97,6 +151,7 @@ function Get-Action {
} }
"ReverseActions" { "ReverseActions" {
try { try {
$Dictionary = $Dictionary[$Version]
$reverseDictionary = @{} $reverseDictionary = @{}
$originalDictionary = switch ($ReverseActionType) { $originalDictionary = switch ($ReverseActionType) {
"Admin" { $Dictionary.AdminActions } "Admin" { $Dictionary.AdminActions }