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
Glenn Prince
Glenn Prince5mo ago
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
Soheel
Soheel5mo ago
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.
Ping
Ping5mo ago
Yeah it's not currently possible. However I'm sure it will in the future.
Filippo
FilippoOP5mo ago
So it's better to just implement a custom script for that
Ping
Ping5mo ago
Yeah
allandelmare
allandelmare2mo ago
@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
Filippo
FilippoOP2mo ago
Hello, I've ended up making a custom role structure. with a table for roles and one for permissions.

Did you find this page helpful?