Hello,
I need some help, how can i automatically add user roles (alanning/meteor-roles) when new user is created.
note: i use Accounts.createUser on the server, to not automatically logged in.
//My Method
newUser(data){
Accounts.createUser(data);
Roles.addUsersToRoles(this.userId, 'super-admin', Roles.GLOBAL_GROUP)
},
//Client
Meteor.call('newUser', account, (err)=>{
if(err){
Bert.alert({
title: 'Error',
message: err.reason,
type: 'warning',
style: 'growl-top-right',
icon: 'fa-warning'
});
} else {
Bert.alert({
title: 'Success',
message: "Success",
type: 'info',
style: 'growl-top-right',
icon: 'fa-info'
});
}
});
Thank you in advance