Hello there.
Using alanning:roles for group management, and last version of everything.
I was following the tutorial on (Official Repository)[https://github.com/alanning/meteor-roles#usage-examples], trying to add the role to the user like this:
// server/main.js
Accounts.onCreateUser(function (options, user) {
Roles.addUsersToRoles(user._id, ['Convidado']);
if (!user.services.facebook) {
...
But this did not work.
When I did this, the user was created with the correct role:
Accounts.onCreateUser(function (options, user) {
user.roles = ['Convidado'];
if (!user.services.facebook) {
Am I doing it wrong? I think I might doing some kind of mistake here, and breaking server side verification.
Another question:
What does the best practice says about onCreateUser location? Should I put this routine another place?
Thanks in advance.