box / boxcli

A command line interface for interacting with the Box API.
https://developer.box.com
Apache License 2.0
222 stars 59 forks source link

chore: User provisioning script updates #403

Closed Smartoneinok closed 2 years ago

Smartoneinok commented 2 years ago

Changed the script to be re-runable with each new csv list of users. Changed the logic and wording from onboarding to "personal folder" Added new field to csv...username...which is used to add a unique identifier to each personal folder created Admin is expected to create an initial personal "root" folder for all other folders to live in Updated readme

Will updated developer guides too

congminh1254 commented 2 years ago

I have error when have empty PersonalFolderSlug and using upload folder:

PS /Users/mcong/boxcli/examples/User Creation & Provisioning> ./Users_Create_Provision.ps1
Please enter the path to the employee list CSV file:
./Employees_1.csv
Please enter the path to the folder structure JSON file or the local upload path:
./PersonalLocalUpload
Local upload path set to: ./PersonalLocalUpload
Please enter the ID of the folder where you would like to create the personal folders:
0
Starting User Creation & Personal Folder Provisioning script...
@{firstName=Test; lastName=User 1; email=ManagedUser1@demo.com; username=manageduser1}
Creating employee Managed User account with first name: Test, last name: User 1, email: ManagedUser1@demo.com
Created Managed user for email: ManagedUser1@demo.com where ID: 20702427588.
Personal Folder Name: manageduser1's  
Failed to upload local folder structure to parent folder with ID 0. Exits script.

Maybe causing by this line:

if (-not $PersonalFolderSlug -and $FolderStructureJSONPath) {
    Write-Log "Please enter the ending slug for each personal folder:" -output true -color Yellow
    $PersonalFolderSlug = Read-Host
}
Smartoneinok commented 2 years ago

@congminh1254 thanks for testing. I will fix that!

Smartoneinok commented 2 years ago

@mgrytsai @congminh1254 made edits... can you all review again please?

For the username... it looks like we weren't requiring a first/last name either... so what I did was if a username isn't supplied, I use the email address...

I also made the slug required whether or not json or path is used... since that is the logic we want.