Roles package problem


#1

I have a problem with roles package… I am bashing my head trough the wall. It constantly crashes my app. This is the error.

  C:\Users\Unknown\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:278
W20150422-11:49:14.097(2)? (STDERR)                                             throw(ex);
W20150422-11:49:14.097(2)? (STDERR)                                                   ^
W20150422-11:49:14.097(2)? (STDERR) Error: Username already exists. [403]
W20150422-11:49:14.097(2)? (STDERR)     at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1027:1)
W20150422-11:49:14.097(2)? (STDERR)     at createUser (packages/accounts-password/password_server.js:718:1)
W20150422-11:49:14.097(2)? (STDERR)     at Object.Accounts.createUser (packages/accounts-password/password_server.js:776:1)
W20150422-11:49:14.097(2)? (STDERR)     at Meteor.methods.addTask.Tasks.insert.title (app\elevator.js:70:35)
W20150422-11:49:14.097(2)? (STDERR)     at Array.forEach (native)
W20150422-11:49:14.097(2)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20150422-11:49:14.097(2)? (STDERR)     at app\elevator.js:69:11

Please help it’s urgent I’m writing this as my undergrad project. Thank you for any kind of help in advance


#2

Is the information in this thread any help?


#3

I wasn’t able to solve that so I tried this…

        Meteor.publish(null, function (){

var users = [ Meteor.users.find({})];
email="Osoba5@qwe.qwe";
if(users == email ){
    users = Meteor.this.userId;
    Roles.createRole('admin');
    Roles.setUserRoles(users, 'admin');
}else{
    users = Meteor.this.userId;
    Roles.createRole(['']);
    Roles.setUserRoles(users,['']);
}
return Meteor.users.find({});

});}

Can I get help with this code. The goal is when creating user there are two user acc one should have admin and the other is normal user without role