Open
Description
Hello,
I am working on admin panel for my app. I use alanning:roles
package. I've created authentication for user, but I have problem with adding authorization. My code looked like below:
router.beforeEach((transition) => {
if(!Meteor.userId()) {
router.go('/login')
}
transition.next();
});
This was working perfect. I tried to add authorization based on roles:
router.beforeEach((transition) => {
if(!Meteor.userId() || Roles.userIsInRole(Meteor.userId(), 'admin')) {
router.go('/login')
}
transition.next();
});
Roles.userIsInRole(Meteor.userId(), 'admin')
always returns false. I have no idea how possible solution could look. Any help will be much appreciated.
Thanks in advance