Role
A role is one of the core components in Role-based access control (RBAC) . It serves as a container for permissions that can be assigned to users, acting as an intermediary between users and their access rights.
A typical role structure contains a name and a set of permissions:
const role = {
name: 'order_admin',
permissions: [
'read:orders', // View order details
'write:orders', // Edit orders
'read:products' // View products
]
}
[!Note] Roles are primarily used for permission management. For access control implementation, it’s recommended to check permissions directly rather than roles. See Role-based access control (RBAC) for more information.