Skip to content

Function: createRbacPlugin() ​

ts
function createRbacPlugin(options?): RbacPlugin;

Defined in: packages/vue/src/plugin.ts:28

Creates the Vue plugin. The returned object is also the RBAC instance, so it can be used outside components (router guards, stores):

ts
export const rbac = createRbacPlugin({ snapshot: window.__RBAC__, wildcard: true })
app.use(rbac)
// later, after login:
rbac.setSnapshot(await api.get('/me/permissions'))

Parameters ​

ParameterType
options?RbacPluginOptions

Returns ​

RbacPlugin

Released under the MIT License. Inspired by spatie/laravel-permission.