forio Toggle navigation

User Manager

The User Manager provides a high-level abstraction over the User Service and Member Services to perform common simulation actions, like uploading users into a group.

     var UserManager = F.manager.User;
     var um = new UserManager(getRunParams());
     um.uploadUsersToGroup($('#userTextarea').val()).then(function(){ alert('Upload sucess!'); }).catch(function (res) {
         if (res.type === UserManager.errors.EMPTY_USERS) {
             alert('No users specified to upload');
         } else if (res.type === UserManager.errors.NO_GROUP_PROVIDED) {
             alert('No group found. Create a group and login as a facilitator to upload users');
         } else {
             alert('Unknown error, please try again');
         }
     });

Constructor options

Required? Name Type Description
Yes userList string list of users seperated by newlines, with each line containing email, firstname, lastname, password separated by tabs/commas
  groupId string id of group to upload to. Defaults to getting current group from session
  options object overrides for service options

Methods

uploadUsersToGroup(userList[, groupId, options])

Bulk creates user accounts and adds them to a group. Input userlist is typically the string contents of a textarea with user data.

Parameters

Required? Name Type Description
Yes userList string list of users seperated by newlines, with each line containing email, firstname, lastname, password separated by tabs/commas
  groupId string id of group to upload to. Defaults to getting current group from session
  options object overrides for service options

Example

um.upload($('#textareaWithUsers').val());