1

I Have added allaning:roles in my meteor-react project but Roles.userIsInRole(Meteor.userId(), ["ADMIN"]) always returning false. I have roles in my mongo as follows,

{ "_id" : "9B3D757wQA9Mz4RGt", "name" : "BUYER" }
{ "_id" : "PDCJH8D6JDo9fttFj", "name" : "ADMINKAMB" }
{ "_id" : "XFGsrfB3Xsm6F8LbQ", "name" : "SELLER" }
{ "_id" : "hDLSvdo6wMnF47BBz", "name" : "ADMIN" }
{ "_id" : "ADMINKAMB", "children" : [ ] }
Tushar Kale
  • 159
  • 1
  • 12

1 Answers1

0

if you remove the autopublish from yours packages, try to add this code

For my case, I create a file /imports/startup/server/publications/index.js

Meteor.publish(null, function() {
    if (this.userId) {
        return Meteor.roleAssignment.find({ 'user._id': this.userId });
    }
    return this.ready();
});

Then in server/main.js

import '/imports/startup/server/publications'