Skip to content

Commit

Permalink
Revert "import update jcusers csv bug fix"
Browse files Browse the repository at this point in the history
This reverts commit 3c17180.
  • Loading branch information
kmaranionjc committed Dec 4, 2024
1 parent 320dd10 commit 2b7a879
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,7 @@ Function Import-JCUsersFromCSV () {
$FormatGroupOutput = $Null
$CustomGroupArrayList = $Null

# Get custom attributes with definitions that are not null
$CustomAttributes = $UserAdd | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" }

# Sort the custom attributes by name
$CustomAttributes = $CustomAttributes | Sort-Object {
[int]([regex]::Match($_.Name, '\d+').Value) },
{ $_.Name }
$CustomAttributes = $UserAdd | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" } | Select-Object

Write-Verbose $CustomAttributes.name.count

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,8 @@ Function Update-JCUsersFromCSV () {
$SystemAddStatus = $Null
$FormatGroupOutput = $Null
$CustomGroupArrayList = $Null
# Get custom attributes with definitions that are not null
$CustomAttributes = $UserUpdate | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" }

# Sort the custom attributes by name
$CustomAttributes = $CustomAttributes | Sort-Object {
[int]([regex]::Match($_.Name, '\d+').Value) },
{ $_.Name }

$CustomAttributes | Format-Table -AutoSize
$CustomAttributes = $UserUpdate | Get-Member | Where-Object Name -Like "*Attribute*" | Where-Object { $_.Definition -NotLike "*=" -and $_.Definition -NotLike "*null" } | Select-Object

if ($CustomAttributes.name.count -gt 1) {
try {
Expand Down Expand Up @@ -386,12 +379,13 @@ Function Update-JCUsersFromCSV () {
}

Write-Verbose "Attributes are $($UpdateParams)"

$NumberOfCustomAttributes = $UpdateParams.Keys | Where-Object { $_ -like "*Attribute*" } | Measure-Object | Select-Object -ExpandProperty Count

$UpdateParams.Add("NumberOfCustomAttributes", $NumberOfCustomAttributes / 2)

$JSONParams = $UpdateParams | ConvertTo-Json
#Write-Debug "$($JSONParams)"

$NewUser = Set-JCUser @UpdateParams

if ($NewUser._id) {
Expand Down
14 changes: 0 additions & 14 deletions PowerShell/ModuleChangelog.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
## 2.15.1

Release Date: December 4, 2024

#### RELEASE NOTES

```
This release introduces a bug fix for `Import-JCUsersFromCSV` and `Update-JCUsersFromCSV` issues with importing more than 10 custom attributes
```

#### BUG FIXES:

- Fixed a bug with `Import-JCUsersFromCSV` and `Update-JCUsersFromCSV` throwing error when importing 10 or more Custom Attributes due to a sorting issue

## 2.15.0

Release Date: November 18, 2024
Expand Down

0 comments on commit 2b7a879

Please sign in to comment.