8000 Vue-router and alanning:roles · Issue #103 · meteor-vue/vue-meteor · GitHub
[go: up one dir, main page]

Skip to content
Vue-router and alanning:roles #103
Open
@suezzo

Description

@suezzo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0