JiriChara / vue-kindergarten

Modular security for Vue, Vuex, Vue-Router and Nuxt
MIT License
312 stars 24 forks source link

$isAllowed() method does not work in template for nuxt #42

Open vadimbashirof opened 5 years ago

vadimbashirof commented 5 years ago

Hi @JiriChara ! I use nuxt. I installed and connected the plugin. I have implemented role based access for routing but I am facing issues while implementing show/hide menu items depending on the logged in user

This code does not work for me:

v-show="$isAllowed('read')"
v-show="$article.isAllowed('update', article)"

What can I do to make it work? Thanks

rclement commented 5 years ago

Hi @vadimbashirof,

I just faced the same issue while migrating a large web-app from Vue.js to Nuxt.js.

When using Vue-Kindergaten with Nuxt.js, you need to (optionally) define two types of perimeters on your page:

The documentation lacks this detail and if you did not used Vue-Kindergarten with vanilla Vue.js before hand, good luck find it.

Hope it helps!