Hi Everyone, please how can i setup Prisma(mysql) ...
# orm-help
h
Hi Everyone, please how can i setup Prisma(mysql) to allow users add new roles dynamically and assign privilege /permission to the roles?
r
@henry 👋 Could you explain in detail what would roles be in this case?
h
so the initial roles would be default user, moderator, admin and super admin roles. but i would also like the super admin to be able to add new user roles and grant them permissions/access to certain resources
r
Create a
Role
model and assign a relationship like this:
Copy code
model User {
  roles Role[]
}

model Role {
}
And then the superuser can add new roles and assign them to users. The check to see if the user performing the action is valid or not will have to be added in your controllers/application logic.
h
thank you
👍 1