Faspex rake task for creating, updating and deleting local users in bulk

Description

Rake tasks are scripts that allow you to retrieve, delete or update information on your Faspex server using the command line. This article describes a custom rake task available to create users in bulk from a csv file.

Usage

The syntax for the bulk user creation rake task is the following:

asctl faspex:rake users:bulk_create -- [options]

The syntax for the bulk user update rake task is the following:

asctl faspex:rake users:bulk_update -- [options]

The syntax for the bulk user deletion rake task is the following:

asctl faspex:rake users:bulk_delete -- [options]

The options for the rake tasks are as follows:

short form long form description
-ufile --user_file=file Path to the csv file specifying attributes to be applied to individual users (required)
 -pfile --properties_file=file Path to the csv file specifying attributes to be applied to all users (required)
 -h --help print out help information for this rake task


The user file should have a format like the following, with the information of each new user per line:

name,first_name,last_name,email
username1,firstname,lastname,email
username2,firstname,lastname,email
username3,firstname,lastname,email
Note that with the deletion rake task only usernames need to be specified.

The properties file would look like this:

type
LocalUser

Examples

To create 3 Faspex users (jdoe, hpotter, bochy) at the same time, you would create a user file /my_home/my_users.csv like the following:

name,first_name,last_name,email
jdoe,Jane,Doe,janedoe@example.com
hpotter,Harry,Potter,harrypotter@asperasoft.com
bochy,Bruce,Bochy,bb@sfgbb.org

Then you would create a properties file /my_home/properties.csv:

type
LocalUser

Finally, the rake task to run would be the following:

asctl faspex:rake users:bulk_create -- -u /my_home/my_users.csv -p /my_home/properties.csv
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk