Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUT-4281: Set-JCUser Null Manager fix #611

Merged
merged 4 commits into from
Oct 1, 2024
Merged

Conversation

gweinjc
Copy link
Contributor

@gweinjc gweinjc commented Sep 30, 2024

Issues

  • CUT-4281 - Set-JCUser Null Manager fix

What does this solve?

Due to the way that PowerShell treats string datatypes, you are unable to truly set a string parameter to null. The manager field requires that the manager field be set to strictly null, an empty string will not work.

In order to solve for this, we simply need to remove the string datatype on the manager parameter. This will default that parameter to accepting 'object' input, which will work in this scenario

Is there anything particularly tricky?

N/A

How should this be tested?

  1. Import the module
  2. Attempt to set a user's manager to $null
Set-JCUser -id <UserID> -manager $null
  1. This should now remove any existing values in the user's manager field

@gweinjc gweinjc added PowerShell Module Release for JumpCloud PowerShell Module patch labels Sep 30, 2024
@gweinjc gweinjc requested a review from a team as a code owner September 30, 2024 23:15
Copy link
Contributor

@kmaranionjc kmaranionjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test worked when setting manager to $null. Great job! Looks good to me

Copy link
Contributor

@jworkmanjc jworkmanjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with Set-JCUser and also validated that the Update-JCUserFromCSV functions were not affected by this change. That appears to be the case.

Looks good to me!

@gweinjc gweinjc merged commit 7195d54 into master Oct 1, 2024
10 checks passed
@gweinjc gweinjc temporarily deployed to PublishToPSGallery October 1, 2024 21:22 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch PowerShell Module Release for JumpCloud PowerShell Module
Development

Successfully merging this pull request may close these issues.

3 participants