Typescript doesn't like my new role of "approved"
I've extended the type according to the docs:
but on the front-end, when I try to do an update role (using the admin plugin), it only wants to see admin or user. Those are the default roles for admin, so how do I get my new role in there?
Solution:Jump to solution
Am I looking at "roles" wrong? I want people to be able to sign up, whcih gives them the "user" role, but I don't want them to be able to do anything until they get approved by an admin.
Currently I am setting a role of "approved" on them (a custom role with the ac stuff). Is that the normal flow?
is this the same perms as the userAc?...
11 Replies
I did create this and pass it to my betterAuth instance, still have the same error tho:
I think I had to pass like this?
and in client:
Is that correct?
https://www.better-auth.com/docs/plugins/admin#pass-roles-to-the-plugin
pretty sure it’s because you forgot to pass the actually updated access control instance to the plugin (the ac object)
Admin | Better Auth
Admin plugin for Better Auth
Solution
Am I looking at "roles" wrong? I want people to be able to sign up, whcih gives them the "user" role, but I don't want them to be able to do anything until they get approved by an admin.
Currently I am setting a role of "approved" on them (a custom role with the ac stuff). Is that the normal flow?
is this the same perms as the userAc?
this approved role now has the same rights as the userRole
in that case you should give the user role no statements most likely
okay but it is correct to create a "role" for what I'm trying to do there
as opposed to trying to set some metadata flag or something
Definitely 👍
I mean you could do either
Thank you
You can roll your own access control
Or go with the one by better-Auth
yeah im trying to stay with some sort of best practices/framework.
In the end it comes down to your needs but the better-Auth probably is more elaborate than what you need, which shouldn’t be a problem though
unfortunately one of the things with these new-er nextjs/typescript projects is that they aren't as opinionated as to some of the older tech stacks (like Drupal, etc). So it sometimes makes it difficult to know what the "best" way is lol