Actually, you just have to publish the roleAssignment collection and for security reasons I recommend you to apply this validation:
Meteor.publish('roles', function () {
return Meteor.roleAssignment.find({'user._id': this.userId});
});
In this way, you can only access to the permissions of the user logged. Also, with this way you can use all the Roles functions.
If you want to access to roles of other users I recommend you to do it through Meteor methods since if you removed the insecure package, the write methods of Roles package are disabled from the client. Although, you can revert that behavior using Meteor.roleAssignment.allow/deny methods but it isn’t recommended.
The current example in the main page of the repo creates an unnamed publication to have this data published automatically without needing an explicit subscription (as per this doc). It also covers the need for the user to be logged in (pretty much the same way diavrank95 is very aptly doing here).
Meteor.publish(null, function () {
if (this.userId) {
return Meteor.roleAssignment.find({ 'user._id': this.userId });
} else {
this.ready()
}
})
we have thousands of users. When admin user goes to some admin pages that lists all users, i need to publish whole role assignment-collection. That is very slow since so many users… is there better way to do this?