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,62 +26,110 @@ function Get-Action {
) )
$Dictionary = @{ $Dictionary = @{
AdminActions = @{ "6.1.2" = @{
ApplyRecord = 'AR' AdminActions = @{
Copy = 'CP' ApplyRecord = 'AR'
Create = 'CR' Copy = 'CP'
FolderBind = 'FB' Create = 'CR'
HardDelete = 'HD' FolderBind = 'FB'
MailItemsAccessed = 'MIA' HardDelete = 'HD'
Move = 'MV' Move = 'MV'
MoveToDeletedItems = 'MTDI' MoveToDeletedItems = 'MTDI'
SendAs = 'SA' SendAs = 'SA'
SendOnBehalf = 'SOB' SendOnBehalf = 'SOB'
Send = 'SD' SoftDelete = 'SD'
SoftDelete = 'SD' Update = 'UP'
Update = 'UP' UpdateCalendarDelegation = 'UCD'
UpdateCalendarDelegation = 'UCD' UpdateFolderPermissions = 'UFP'
UpdateFolderPermissions = 'UFP' UpdateInboxRules = 'UIR'
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'
}
} }
DelegateActions = @{ "6.1.3" = @{
ApplyRecord = 'AR' AdminActions = @{
Create = 'CR' ApplyRecord = 'AR'
FolderBind = 'FB' Copy = 'CP'
HardDelete = 'HD' Create = 'CR'
MailItemsAccessed = 'MIA' FolderBind = 'FB'
Move = 'MV' HardDelete = 'HD'
MoveToDeletedItems = 'MTDI' MailItemsAccessed = 'MIA'
SendAs = 'SA' Move = 'MV'
SendOnBehalf = 'SOB' MoveToDeletedItems = 'MTDI'
SoftDelete = 'SD' SendAs = 'SA'
Update = 'UP' SendOnBehalf = 'SOB'
UpdateFolderPermissions = 'UFP' Send = 'SD'
UpdateInboxRules = 'UIR' SoftDelete = 'SD'
} Update = 'UP'
OwnerActions = @{ UpdateCalendarDelegation = 'UCD'
ApplyRecord = 'AR' UpdateFolderPermissions = 'UFP'
Create = 'CR' UpdateInboxRules = 'UIR'
HardDelete = 'HD' }
MailboxLogin = 'ML' DelegateActions = @{
MailItemsAccessed = 'MIA' ApplyRecord = 'AR'
Move = 'MV' Create = 'CR'
MoveToDeletedItems = 'MTDI' FolderBind = 'FB'
Send = 'SD' HardDelete = 'HD'
SoftDelete = 'SD' MailItemsAccessed = 'MIA'
Update = 'UP' Move = 'MV'
UpdateCalendarDelegation = 'UCD' MoveToDeletedItems = 'MTDI'
UpdateFolderPermissions = 'UFP' SendAs = 'SA'
UpdateInboxRules = 'UIR' SendOnBehalf = 'SOB'
SoftDelete = 'SD'
Update = 'UP'
UpdateFolderPermissions = 'UFP'
UpdateInboxRules = 'UIR'
}
OwnerActions = @{
ApplyRecord = 'AR'
Create = 'CR'
HardDelete = 'HD'
MailboxLogin = 'ML'
MailItemsAccessed = 'MIA'
Move = 'MV'
MoveToDeletedItems = 'MTDI'
Send = 'SD'
SoftDelete = 'SD'
Update = 'UP'
UpdateCalendarDelegation = 'UCD'
UpdateFolderPermissions = 'UFP'
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 }
@@ -119,4 +174,4 @@ function Get-Action {
} }
} }
} }
} }