TheJumpCloud / jcapi-powershell

MIT License
10 stars 3 forks source link

CUT-3929: Fix BulkUser models #72

Closed gweinjc closed 5 months ago

gweinjc commented 7 months ago

Issues

What does this solve?

The BulkUser models only allowed editing select properties instead of all systemUser properties that is indicated by the endpoint.

Before:

image

After:

image image

Is there anything particularly tricky?

A few of the properties were references to other existing models that had to be transformed/flattened such as the 'mfa' property.

How should this be tested?

  1. Import the latest version of JumpCloud.SDK.V2
  2. Run the below script to test updating 2 users. Be sure to change the respective Ids to user's in your organization
    $users = @(
    @{
        id = '612010ef83e5ac3835fe0c57'
        jobTitle = 'BulkUpdateTest'
        department = 'BulkUpdateTest'
        Manager = '636a9aaf4db1beb9f7cb28dd'
        description = 'BulkUpdateTest'
     },
    @{
         id = '636a9aaf4db1beb9f7cb28dd'
         jobTitle = 'BulkUpdateTest'
         department = 'BulkUpdateTest'
         Manager = '612010ef83e5ac3835fe0c57'
         description = 'BulkUpdateTest'
     }
    )
    Update-JcSdkBulkUser -Body $users
  3. Run the below script to test creating 2 users
    $users = @(
    @{
        email = 'bulkUser1@jcbulkusertest.com'
        firstName = 'BulkUser1'
        lastName = 'BulkUser1'
        username = 'BulkUser1'
        jobTitle = 'BulkCreateTest'
        department = 'BulkCreateTest'
        description = 'BulkCreateTest'
     },
     @{
        email = 'bulkUser2@jcbulkusertest.com'
        firstName = 'BulkUser2'
        lastName = 'BulkUser2'
        username = 'BulkUser2'
        jobTitle = 'BulkCreateTest'
        department = 'BulkCreateTest'
        description = 'BulkCreateTest'
     }
    )
    New-JCSdkBulkUser -Body $users -CreationSource 'jumpcloud:bulk'
  4. Go into the Console and validate that the 2 created user's have their respective properties set and the updated users have theirs set as well.