Adding roles to Redwood.JS own dbAuth

Any guide on this in the documentation, most examples are dealing with auth provided by 3-party services such netlify but I’m using Redwood.JS own authentication(dbAuth).

The RBAC Cookbook on the main docs site has some suggestions – you manage a UserRoles table.

If I had to re-write it (and support Postgres only) I would use Prisma/PG Enums for the role names – but for this cookbook using strings since that is what SQLLite can support.

enum Role {
  ADMIN 
  EDITOR
  PUBLISHER
}
model UserRole {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  role      ROLE
  user      User?    @relation(fields: [userId], references: [id])
  userId    Int?

  @@unique([role, userId])
}