🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.
superRole
validationrole-or-permission
directive now supports modifiersVue 3 support
import { createApp } from 'vue'
import VueGates from 'vue-gates'
import App from './App.vue'
createApp(App)
.use(VueGates)
.mount('#app')
To learn more about the Vue 3, see the official documentation.
Super role avoids all role and permission validations
import Vue from 'vue';
import VueGates from 'vue-gates';
Vue.use(VueGates, {
superRole: 'admin',
});
To learn more about the configuration, see the official documentation.
Wildcards support
// Example 1:
this.$gates.setPermissions(['posts.*', 'images.create']);
// Example 2:
this.$gates.setPermissions(['posts.*.*', 'images.create']);
// Example 3:
this.$gates.setPermissions(['*.create']);
// Example 4:
this.$gates.setPermissions(['*']);
To learn more about the methods, see the official documentation.