AtlassianPS / JiraPS

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

New-JiraUser function does not send notification e-mail to new users #382

Closed skuzzles closed 4 years ago

skuzzles commented 5 years ago

Description

While working on a script to bulk import new users to our Jira environment, I came across a bug where nearly created users did not receive an e-mail notification when added via the New-JiraUser function.

Steps To Reproduce

Use a valid e-mail address, and execute the following:

New-JiraUser -UserName "testname" -EmailAddress "Test@testy.com" -DisplayName "Testy McTester"

Expected behavior

No account created e-mail from JIRA

Screenshots

Your Environment

Currently using JIRA 8.3.4. and JiraPS module 2.12.2

Possible Solution

Edit function New-JiraUser

  1. Change Notify from Boolean to String and set default value to "true"
  2. Edit $requestBody = @() and change "Notify" to "notification"

Reference JIRA API: https://docs.atlassian.com/software/jira/docs/api/REST/8.4.2/?_ga=2.250034694.1238304929.1570027951-351338371.1565634928#api/2/user-createUser

replicaJunction commented 4 years ago

I'd suggest that instead of adding a Boolean parameter with a default value, it would be a better user experience to identify the desired default behavior, then create a Switch parameter to change that behavior. (In this case, when I say "user experience," I'm talking about the PowerShell coder, not the end user whose account that coder is creating.)

Personally, I think the default value should be false, and a -Notify parameter could be added that adds the behavior to notify the new user. I could see an argument for the other way around too, though - notify by default, but add a -NoNotify parameter to prevent that behavior.

johnheusinger commented 4 years ago

Simply changing 'notify' to 'notification' in the request body resolves the issue without changing any functionality, so I think that's the way to go