Generate CASL rules for navigation based on nuxt routes. To be used with casl-django
The module features autogeneration of default navigation routes, creating a json fixture that you can load in your django project to get going with default rules you can assign to your users.
- Add
casl-django-nuxtdependency using yarn or npm to your project - Add
casl-django-nuxttomodulessection ofnuxt.config.js
{
modules: [
// Simple usage
'casl-django-nuxt',
// With options
['casl-django-nuxt', { /* module options */ }],
]
}- Add
casl-django-nuxtto yourmodules - Build your project with
yarn run build
This will generate a json file called rules.json inside dist/_nuxt, copy that
to your Django app fixtures folder and load it.
{
modules: [
'casl-django-nuxt',
// Or with more options
[
'casl-django-nuxt',
{
initialPK: 12,
model: 'myApp.CustomPermissionModel',
subject: 'myNavSubject'
}
]
]
}- Clone this repository
- Install dependencies using
yarn installornpm install - Start development server using
npm run dev
Copyright (c) José Carlos López carlos@nopalcreativa.com