User is not able to ban user, even when he is admin of the org
getting {"message":"Only admins can access this endpoint","code":"ONLY_ADMINS_CAN_ACCESS_THIS_ENDPOINT"} , when client calls
await admin.banUser({ userId: values.userId });
3 Replies
I am confused about this particular condition in the source code -
https://github.com/better-auth/better-auth/blob/58ad15dd52aafc747fb8e176b4af2ac573ff2d84/packages/better-auth/src/plugins/admin/index.ts#L85C24-L85C33
Where do we provide
opts
,
I am intending to -
Owner will create org and and will invite many users, he will appoint one of the user as admin
(this sets the membership.role
as admin
, that user should be able to ban user as well.GitHub
better-auth/packages/better-auth/src/plugins/admin/index.ts at 58ad...
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
I get it now. It is
user.role
and opts come from what is passed to admin plugin while configuring as below
I am yet to figure out, how to set this custom role of orgAdmin
at user
table while sending him invite. so that he can ban userUnknown User•4mo ago
Message Not Public
Sign In & Join Server To View