AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
322 stars 131 forks source link

Remove-JiraUser fails #367

Closed johnmccrae closed 4 years ago

johnmccrae commented 4 years ago

Description

Remove-JiraUser fails with a user not found or you don't have permission error

Steps To Reproduce

Remove-JiraUser -User foo -credentials $mycreds -verbose -debug

Expected behavior

A removed user or a warning about owned issues

Your Environment

Get-Module JiraPS -ListAvailable | Select Name, Version
$PSVersionTable
Name   Version
----   -------
JiraPS 2.11.1

Name                           Value
----                           -----
PSVersion                      6.2.1
PSEdition                      Core
GitCommitId                    6.2.1
OS                             Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Possible Solution

Change line 4881 of https://github.com/AtlassianPS/JiraPS/blob/9786aa03798de8a75b4ebdb897b5729472a88f13/JiraPS/Public/Remove-JiraUser.ps1#L62

From:

$userObj = Get-JiraUser -InputObject $_user -Credential $Credential -ErrorAction Stop 

To:

$userObj = Get-JiraUser -UserName $_user -Credential $Credential -ErrorAction Stop