Skip to content

Commit

Permalink
Release of 2.13
Browse files Browse the repository at this point in the history
Merge pull request #406 from AtlassianPS/develop
  • Loading branch information
lipkau committed Feb 23, 2020
2 parents 0c081ad + 9d2ad83 commit ca56170
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## [NEXT VERSION] - YYYY-MM-DD

## [2.13] - 2020-02-23

### Added

- Add support for activation/deactivation of accounts via `Set-JiraUser` (#385, [@johnheusinger])

### Changed

- Removed progress bar from `Invoke-WebRequest` for better performance (#380, [@sgtwilko])

## [2.12] - 2019-08-15

### Added
Expand Down Expand Up @@ -30,7 +40,7 @@
### Added

- Parameter for retrieving information about a specific user with `Get-JiraUser` (#328, [@michalporeba])
- this implementations will be changed with the next major update in favor of #306
- this implementations will be changed with the next major update in favor of #306

### Changed

Expand Down Expand Up @@ -346,6 +356,7 @@ which is in turn inspired by the [Vagrant](https://github.com/mitchellh/vagrant/
[@ebekker]: https://github.com/ebekker
[@hmmwhatsthisdo]: https://github.com/hmmwhatsthisdo
[@jkknorr]: https://github.com/jkknorr
[@johnheusinger]: https://github.com/johnheusinger
[@kb-cs]: https://github.com/kb-cs
[@kittholland]: https://github.com/kittholland
[@liamleane]: https://github.com/LiamLeane
Expand All @@ -355,6 +366,7 @@ which is in turn inspired by the [Vagrant](https://github.com/mitchellh/vagrant/
[@mirrorgleam]: https://github.com/mirrorgleam
[@nojp]: https://github.com/nojp
[@padgers]: https://github.com/padgers
[@sgtwilko]: https://github.com/sgtwilko
[@thepsadmin]: https://github.com/ThePSAdmin
[@tuxgoose]: https://github.com/tuxgoose
[@vercellone]: https://github.com/vercellone
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/JiraPS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'JiraPS.psm1'

# Version number of this module.
ModuleVersion = '2.12'
ModuleVersion = '2.13'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
7 changes: 7 additions & 0 deletions JiraPS/Public/Invoke-JiraMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ function Invoke-JiraMethod {
#endregion Constructe IWR Parameter

#region Execute the actual query
# Normal ProgressPreference really slows down invoke-webrequest as it tries to update the screen for bytes received.
# By setting ProgressPreference to silentlyContinue it doesn't try to update the screen and speeds up the downloads.
# See https://stackoverflow.com/a/43477248/2641196
$oldProgressPreference = $progressPreference
$progressPreference = 'silentlyContinue'
try {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] $($splatParameters.Method) $($splatParameters.Uri)"
Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoke-WebRequest with `$splatParameters: $($splatParameters | Out-String)"
Expand All @@ -164,6 +169,8 @@ function Invoke-JiraMethod {
$exception = $_
$webResponse = $exception.Exception.Response
}
# Reset the progressPreference to the value it was before the Invoke-WebRequest
$progressPreference = $oldProgressPreference

Write-Debug "[$($MyInvocation.MyCommand.Name)] Executed WebRequest. Access `$webResponse to see details"
Test-ServerResponse -InputObject $webResponse -Cmdlet $Cmdlet
Expand Down
10 changes: 9 additions & 1 deletion JiraPS/Public/Set-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function Set-JiraUser {
[String]
$EmailAddress,

[Parameter( ParameterSetName = 'ByNamedParameters' )]
[Boolean]
$Active,

[Parameter( Position = 1, Mandatory, ParameterSetName = 'ByHashtable' )]
[Hashtable]
$Property,
Expand Down Expand Up @@ -90,7 +94,7 @@ function Set-JiraUser {

switch ($PSCmdlet.ParameterSetName) {
'ByNamedParameters' {
if (-not ($DisplayName -or $EmailAddress)) {
if (-not ($DisplayName -or $EmailAddress -or $PSBoundParameters.ContainsKey('Active'))) {
$errorMessage = @{
Category = "InvalidArgument"
CategoryActivity = "Validating Arguments"
Expand All @@ -107,6 +111,10 @@ function Set-JiraUser {
if ($EmailAddress) {
$requestBody.emailAddress = $EmailAddress
}

if ($PSBoundParameters.ContainsKey('Active')) {
$requestBody.active = $Active
}
}
'ByHashtable' {
$requestBody = $Property
Expand Down
25 changes: 19 additions & 6 deletions docs/en-US/commands/Set-JiraUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Modifies user properties in JIRA
### ByNamedParameters (Default)

```powershell
Set-JiraUser [-User] <Object[]> [-DisplayName <String>] [-EmailAddress <String>] [-Credential <PSCredential>]
[-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-JiraUser [-User] <Object[]> [-DisplayName <String>] [-EmailAddress <String>] [[-Active] <Boolean>]
[-Credential <PSCredential>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ByHashtable
Expand Down Expand Up @@ -104,6 +104,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Active
Sets user to active or inactive.
```yaml
Type: Boolean
Parameter Sets: ByNamedParameters
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Property
Hashtable (dictionary) of additional information to set.
Expand Down Expand Up @@ -204,10 +220,7 @@ to the JIRA user modified. Otherwise, this function does not provide output.

## NOTES

It is currently NOT possible to enable and disable users with this function.
JIRA does not currently provide this ability via their REST API.

> If you'd like to see this ability added to JIRA and to this module, please vote on Atlassian's site for this issue: [https://jira.atlassian.com/browse/JRA-37294](https://jira.atlassian.com/browse/JRA-37294)
The `-Active` parameter is supported only in Jira Server version 8.3.0 and above.

This function requires either the `-Credential` parameter to be passed or a persistent JIRA session.
See `New-JiraSession` for more details.
Expand Down

0 comments on commit ca56170

Please sign in to comment.