Hi,
I try to add a role when an user just sing up
import {Roles} from '@alanning/roles';
updateProfile(profile: Profile): void {
console.log("Enter updateProfile");
if (!this.userId) {
throw new Meteor.Error('unauthorized','User must be logged-in to access a profile');
}
check(profile, {
firstname: nonEmptyString,
lastname: nonEmptyString,
birthday: nonEmptyString,
email: nonEmptyString,
phonenumber: nonEmptyString,
});
Meteor.users.update(this.userId, {$set: {profile}});
if(Roles.getRolesForUser(this.userId).length == 0)
{
Roles.addUsersToRoles(this.userId,'unchecked');
}
But i having this error:
Exception while invoking method 'updateProfile' TypeError: roles_1.Roles.getRolesForUser is not a function
I20180502-15:28:42.731(4)? at MethodInvocation.updateProfile (server/methods.ts:77:18)
I20180502-15:28:42.731(4)? at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1768:12)
I20180502-15:28:42.731(4)? at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
I20180502-15:28:42.732(4)? at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12)
I20180502-15:28:42.732(4)? at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
I20180502-15:28:42.732(4)? at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12)
I20180502-15:28:42.732(4)? at Promise (packages/ddp-server/livedata_server.js:715:46)
I20180502-15:28:42.733(4)? at new Promise (<anonymous>)
I20180502-15:28:42.733(4)? at Session.method (packages/ddp-server/livedata_server.js:689:23)
I20180502-15:28:42.733(4)? at packages/ddp-server/livedata_server.js:559:43
Thanks in advance for your help.