feat: add GetAllUsers() API to separate users from roles#1652
feat: add GetAllUsers() API to separate users from roles#1652
Conversation
|
|
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Benchmark ComparisonComparing base branch ( 🤖 This comment will be automatically updated with the latest benchmark results. |
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
|
@copilot remove TestGetUsersAndRoles don't add GetUsers() and GetRoles() alias APIs |
…test Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Done. Removed TestGetUsersAndRoles, TestGetUsersWithNoRoles, and the GetUsers()/GetRoles() alias APIs. Only GetAllUsers() remains. Changes in commit 32cb8c0. |
|
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Casbin currently returns both users and roles together via
GetAllSubjects(), making it impossible to distinguish between them programmatically.Changes
GetAllUsers(): Returns subjects that are not roles (subjects - roles)Enforcer,SyncedEnforcer, andIEnforcerinterfaceImplementation
Users are computed as the set difference between all policy subjects and grouping policy roles (field index 1 in
gpolicies):Usage
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.