Open jcharcosset opened 4 years ago
Currently to integrate with Vue Router I'm putting the check in the beforeEnter
callback
{
path: '/surveys/:survey_id/edit', component: SurveyForm,
beforeEnter: (to, from, next) => {
if (!router.app.$gates.hasAnyRole('Admin|Super Admin') ||
!!router.app.$store.state.surveys.find(s => s.id === parseInt(to.params.survey_id)) {
next('/surveys');
}
next();
}
},
It would be really nice to just pass meta: { middlewares: ['admin', 'owner'] }
and if route params were available in the middleware
Is it planned an integration with vue-router ? Could we authorize route depend of roles and/or permissions with meta field