Overview
Nuxt Permissions is a package designed for integrating roles and permissions with a Nuxt application. It serves as a complementary solution for backend permissions and should not be relied upon as the sole solution. However, it is important to note that this package is currently in alpha version and is not suitable for use in production. The package is still a work in progress and may undergo changes in the future.
Features
- Integration of roles and permissions with a Nuxt application
- Use of usePermissions or useRoles composable to set user permissions or roles
- Middleware usage with the ability to set permissions or roles in definePageMeta
- Directives (v-can, v-can:not, v-role, v-role:not) for conditional rendering based on permissions or roles
Installation
To install Nuxt Permissions, follow these steps:
- Add the module to your nuxt.config.js or nuxt.config.ts file.
- Set the ssr property to false.
- Use the usePermissions or useRoles composable to set user permissions or roles.
- Set nuxt-permissions as middleware and add permissions or roles in definePageMeta for the desired pages.
Example:
import permissions from 'nuxt-permissions'
export default {
modules: [
permissions
],
permissions: {
permissions: ['access dashboard'],
roles: ['admin']
}
}
Summary
Nuxt Permissions is a package that allows for easy integration of roles and permissions with a Nuxt application. It provides a convenient way to set user permissions or roles, and offers middleware usage and directives for conditional rendering based on permissions or roles. However, it is important to note that this package is still in alpha version and should not be used in production.