daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Feb 4th, 2016 152 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var users=[{username: "admin",email: 'admin@admin.com',verified: true,
  2.             password:"admin123",roles: 'admin'},
  3.             {username: "sheng",email: 'sheng@admin.com',verified: true,
  4.                             password:"sheng123",roles: []},
  5.             {username: "test", email: "test@test.com",verified:true,
  6.                                 password: "test123",roles:[]}
  7.         ];
  8.  
  9.  
  10. _.each(users, function(user){
  11.  var id;
  12.  id=Accounts.createUser({
  13.      username:user.username,
  14.      email:user.email,
  15.      verified: true,
  16.      password:user.password,
  17.      profile:{name:user.username}
  18.  });
  19.  if(user.hasOwnProperty('roles') && user.roles.length>0){
  20.      Roles.addUsersToRoles(id, user.roles,  Setting.name); ///error here
  21.  }
  22. });
  23.    
  24. var users=[{username: "admin",email: 'admin@admin.com',verified: true,
  25.             password:"admin123",roles: 'admin'},
  26.             {username: "sheng",email: 'sheng@admin.com',verified: true,
  27.                             password:"sheng123",roles: []},
  28.             {username: "test", email: "test@test.com",verified:true,
  29.                                 password: "test123",roles:[]}
  30.         ];
  31.  
  32.  
  33. _.each(users, function(user){
  34.  var id;
  35.  id=Accounts.createUser({
  36.      username:user.username,
  37.      email:user.email,
  38.      verified: true,
  39.      password:user.password,
  40.      profile:{name:user.username}
  41.  });
  42.  if(user.hasOwnProperty('roles') && user.roles.length>0){
  43.      console.log(user)
  44.  }
  45. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top