[GH-ISSUE #6625] Implement hasRole endpoint in admin plugin #10574

Closed
opened 2026-04-13 06:48:34 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @chris23lngr on GitHub (Dec 9, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6625

Is this suited for github?

  • Yes, this is suited for github

There is no clean or native way to check whether a user (other than the one currently logged in) has one or more specific roles. I am aware that it makes sense and is safer to check for individual permissions, but in some scenarios it can be helpful to perform a simple role comparison.

Describe the solution you'd like

An endpoint in the admin plugin that checks whether a user has a role. In my opinion, this should be relatively easy to implement. I am happy to implement the feature myself.

Describe alternatives you've considered

My workaround so far has always been to check whether the target user has a permission that is only held by a specific role. However, this means that certain permissions can no longer be distributed flexibly and breaks the workflow if other groups also need this permission.

Additional context

No response

Originally created by @chris23lngr on GitHub (Dec 9, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6625 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. There is no clean or native way to check whether a user (other than the one currently logged in) has one or more specific roles. I am aware that it makes sense and is safer to check for individual permissions, but in some scenarios it can be helpful to perform a simple role comparison. ### Describe the solution you'd like An endpoint in the admin plugin that checks whether a user has a role. In my opinion, this should be relatively easy to implement. I am happy to implement the feature myself. ### Describe alternatives you've considered My workaround so far has always been to check whether the target user has a permission that is only held by a specific role. However, this means that certain permissions can no longer be distributed flexibly and breaks the workflow if other groups also need this permission. ### Additional context _No response_
GiteaMirror added the enhancementlocked labels 2026-04-13 06:48:34 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 9, 2025):

Thanks for opening this issue! It sounds like a useful feature to provide a native way to check a user’s roles without relying on workarounds that tie roles to individual permissions. Currently, our admin plugin primarily focuses on permission checks per endpoint, so adding a dedicated endpoint—say, admin.hasRole—to verify a specific role or a set of roles for any user would simplify many workflows. This suggestion aligns with earlier discussions on dynamic role management and checks for multiple permission groups, which have highlighted the need for a more straightforward role comparison [1], [2].

A good next step would be to define the API contract for the new endpoint (for example, the expected input structure, response format, and any error cases) and discuss how it should interact with the existing dynamic roles and permissions system. Your willingness to implement this feature is great, and it would be helpful to see a proposal or prototype as a pull request so we can collaborate on refining it.

How would you like to structure this endpoint, and do you have any specific requirements in terms of response handling and performance considerations? Tag @bekacru and @ping__ if further discussion is needed. Tag @better-auth-agent if you would like an answer from the Agent.

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3629890332 --> @better-auth-agent[bot] commented on GitHub (Dec 9, 2025): Thanks for opening this issue! It sounds like a useful feature to provide a native way to check a user’s roles without relying on workarounds that tie roles to individual permissions. Currently, our admin plugin primarily focuses on permission checks per endpoint, so adding a dedicated endpoint—say, admin.hasRole—to verify a specific role or a set of roles for any user would simplify many workflows. This suggestion aligns with earlier discussions on dynamic role management and checks for multiple permission groups, which have highlighted the need for a more straightforward role comparison [[1]](https://github.com/better-auth/better-auth/issues/6446), [[2]](https://github.com/better-auth/better-auth/issues/1559). A good next step would be to define the API contract for the new endpoint (for example, the expected input structure, response format, and any error cases) and discuss how it should interact with the existing dynamic roles and permissions system. Your willingness to implement this feature is great, and it would be helpful to see a proposal or prototype as a pull request so we can collaborate on refining it. How would you like to structure this endpoint, and do you have any specific requirements in terms of response handling and performance considerations? Tag @bekacru and @ping__ if further discussion is needed. Tag @better-auth-agent if you would like an answer from the Agent. _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@dosubot[bot] commented on GitHub (Mar 10, 2026):

Hi, @chris23lngr. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary

  • You requested a hasRole endpoint in the admin plugin to simplify checking user roles beyond current permission-based workarounds.
  • The maintainer acknowledged this feature's usefulness and its alignment with previous discussions on dynamic role management.
  • There has been encouragement for you to propose the API contract and collaborate on a prototype.
  • No implementation or concrete design has been made yet; the conversation remains open for input and development.

Next Steps

  • Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue to keep the discussion active.
  • If I do not hear back within 7 days, this issue will be automatically closed to keep the backlog manageable.

Thank you for your understanding and contribution!

<!-- gh-comment-id:4032698591 --> @dosubot[bot] commented on GitHub (Mar 10, 2026): Hi, @chris23lngr. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary** - You requested a `hasRole` endpoint in the admin plugin to simplify checking user roles beyond current permission-based workarounds. - The maintainer acknowledged this feature's usefulness and its alignment with previous discussions on dynamic role management. - There has been encouragement for you to propose the API contract and collaborate on a prototype. - No implementation or concrete design has been made yet; the conversation remains open for input and development. **Next Steps** - Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue to keep the discussion active. - If I do not hear back within 7 days, this issue will be automatically closed to keep the backlog manageable. Thank you for your understanding and contribution!
Author
Owner

@github-actions[bot] commented on GitHub (Mar 31, 2026):

This issue has been locked as it was closed more than 7 days ago. If you're experiencing a similar problem or you have additional context, please open a new issue and reference this one.

<!-- gh-comment-id:4165915512 --> @github-actions[bot] commented on GitHub (Mar 31, 2026): This issue has been locked as it was closed more than 7 days ago. If you're experiencing a similar problem or you have additional context, please open a new issue and reference this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10574