forked from AtlassianPS/JiraPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AtlassianPS#371 from lipkau/release/v2.12
- Loading branch information
Showing
29 changed files
with
1,473 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function Resolve-JiraUser { | ||
<# | ||
#ToDo:CustomClass | ||
Once we have custom classes, this will no longer be necessary | ||
#> | ||
[CmdletBinding()] | ||
param( | ||
[Parameter( ValueFromPipeline )] | ||
[ValidateNotNullOrEmpty()] | ||
[ValidateScript( | ||
{ | ||
if (("JiraPS.User" -notin $_.PSObject.TypeNames) -and (($_ -isnot [String]))) { | ||
$exception = ([System.ArgumentException]"Invalid Type for Parameter") #fix code highlighting] | ||
$errorId = 'ParameterType.NotJiraUser' | ||
$errorCategory = 'InvalidArgument' | ||
$errorTarget = $_ | ||
$errorItem = New-Object -TypeName System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $errorTarget | ||
$errorItem.ErrorDetails = "Wrong object type provided for User. Expected [JiraPS.User] or [String], but was $($_.GetType().Name)" | ||
$PSCmdlet.ThrowTerminatingError($errorItem) | ||
} | ||
else { | ||
return $true | ||
} | ||
} | ||
)] | ||
[Object] | ||
$InputObject, | ||
|
||
[Switch] | ||
$Exact, | ||
|
||
# Authentication credentials | ||
[Parameter()] | ||
[System.Management.Automation.PSCredential] | ||
[System.Management.Automation.Credential()] | ||
$Credential = [System.Management.Automation.PSCredential]::Empty | ||
) | ||
|
||
# As we are not able to use proper type casting in the parameters, this is a workaround | ||
# to extract the data from a JiraPS.Issue object | ||
# This shall be removed once we have custom classes for the module | ||
if ("JiraPS.User" -in $InputObject.PSObject.TypeNames) { | ||
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Using `$InputObject as object" | ||
return $InputObject | ||
} | ||
else { | ||
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve User to object" | ||
return (Get-JiraUser -UserName $InputObject -Exact:$Exact -Credential $Credential -ErrorAction Stop) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.