Bo3o
BABetter Auth
•Created by Bo3o on 3/10/2025 in #help
Unable to add impersonate permission to a new role
I just modified the has-permission helper in order to consider the roles defined under adminRoles
21 replies
BABetter Auth
•Created by Bo3o on 3/10/2025 in #help
Unable to add impersonate permission to a new role
@LeMonsalve admin endpoint does not check adminRoles at all, it only checks if ther user's id exists in the adminUserIds, or if the role is the default adminRole
21 replies
BABetter Auth
•Created by Bo3o on 3/10/2025 in #help
Unable to add impersonate permission to a new role
still documented and there is no mention of deprecation
21 replies
BABetter Auth
•Created by Bo3o on 3/10/2025 in #help
Unable to add impersonate permission to a new role
Yes that's exactly the issue I faced while trying to create a manager role with impersonating permission, tried it by correctly setting the roles and permission, works anywhere except for the admin api, I have modified the mentionned helper that checks the permissions to make it work with predefined adminRoles
21 replies
BABetter Auth
•Created by Bo3o on 3/10/2025 in #help
Unable to add impersonate permission to a new role
No, actually there was an issue with a check that the admin plugin performs at the endpoint stage.
It only checks the adminUserIds array, and it completely ignores adminRoles.
https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/admin/has-permission.ts
21 replies