Configuring Users With Rake Tasks

Use rake tasks to create, modify, and delete users; to import SAML and LDAP users; and to export users to and import users from .csv files.

Rake tasks must be run from the Shares shell, as described in the following steps:
  1. Go to the shares folder:
    > cd C:\Shares\www
  2. Test that your rake tasks are working correctly.
    > bundle exec rake -T

Create User

> bundle exec rake data:user:create -- --username username --password password --email email_address --first_name first_name --last_name last_name

For example:

> bundle exec rake data:user:create -- --username johndoe --password ********* --email john@shares.example.com --first_name John --last_name Doe

By default, Shares requires a user to change their password when they first log in. You can disable that requirement by setting the --set_password option to true. For example:

> bundle exec rake data:user:create -- --username johndoe --password ********* --email john@shares.example.com --first_name John --last_name Doe --set_password true

Delete User

> bundle exec rake data:user:delete -- --username username

For example:

> bundle exec  rake data:user:delete -- --username johndoe

Update User

> bundle exec rake data:user:update -- --username username --password password --email email --first_name first_name --last_name last_name

For example:

> bundle exec rake data:user:update -- --username johndoe --password ********* --email john@shares.example.com --first_name John --last_name Doe

Export a List of Users

> bundle exec rake data:user:export -- --path \path\to\file

For example:

> bundle exec rake data:user:export -- --path C:\temp\projectgroups.txt

The export command writes the groups into a .txt file. For example, the projectgroups.txt file may read like below:

projectgroup1
projectgroup2

Import Users (from .csv)

Note: The .csv file must use the following format:
Username, Email, First Name, Last Name, Password
> bundle exec rake data:user:import -- --path \path\to\file

For example:

> bundle exec rake data:user:import -- --path C:\temp\users.csv
Important: By default, users created by this rake command are not allowed to log into Shares. A Shares admin can set login permissions for these users one by one by going to Admin > Users, selecting the user, clicking Edit Security, and selecting the Login permission. Users for whom no passwords are specified are assigned a random password and must click the Forgot your username and password? link to reset their password and log in.

Import SAML User

> bundle exec rake data:user:saml:import -- --id full_distinguished_name --name_id shares_username [--option option_value]
Note: Delimit distinguished names containing spaces with quotes (").
When running the create and update tasks, you can add the following options to your command to set values for the Shares user's fields:
Option Description
--given_name given_name This value determines the Shares user's first name.
--surname surname This value determines the Shares user's last name.
--email email This value determines the Shares user's email address.

For example:

> bundle exec rake data:user:saml:import -- --id "CN=saml doe,OU=AK,OU=Users,OU=Asperasoft,DC=dev,DC=aspera,DC=us" --name_id samldoe --given_name Sam --surname Doe --email samldoe@shares.example.com

Delete SAML User

> bundle exec rake data:user:saml:delete -- --username username

For example:

> bundle exec rake data:user:saml:delete -- --username samldoe

Fetch User Details from LDAP

> bundle exec rake data:group:ldap:fetch -- --username username

For example:

> bundle exec rake data:group:ldap:fetch -- --username ldapdoe

Delete LDAP User

> bundle exec rake data:user:ldap:delete -- --username username

For example:

> bundle exec rake data:user:ldap:delete -- --username ldapdoe