Create new roles and permissions client side
Hello,
my app is based on user roles and permissions. I want to create a page where the admin user can create and manage new roles and assign permissions. However, better auth does not have a role and permission tables. Is it possible to do what I have in mind?
7 Replies
You could use the admin plugin to do most of this: https://www.better-auth.com/docs/plugins/admin
Admin | Better Auth
Admin plugin for Better Auth
I’m fairly certain that’s not an option for @Filippo, as the plugin’s configuration appears to be immutable at runtime.
That said, it’s generally possible to add your own tables to the database and handle role and permission checks manually.
The admin plugin does offer a predefined set of roles and rules, but since these are static and must be configured ahead of time, it might be more flexible to implement your own access control system alongside better-auth.
Yeah it's not currently possible. However I'm sure it will in the future.
So it's better to just implement a custom script for that
Yeah
@Filippo did you end up implementing a custom permissions system? I'm dealing with the same myself. Could hardcode all the permissions I want, but would really like the ability to create dynamic database-loaded access control/permissions ... would love to see this implemented in a future release
Hello, I've ended up making a custom role structure. with a table for roles and one for permissions.