-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add get_all_roles_by_domain api #316
Conversation
@Nekotoxin please review |
for policy in policies: | ||
if policy[len(policy) - 1] == domain: | ||
role = policy[len(policy) - 2] | ||
if role not in roles: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use set+sort
or dict key to list
to improve performance.
if role not in roles: | ||
roles.add(role) | ||
|
||
return list(roles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BustDot The set is unordered. If the order is not required to get all roles here, then I think it is ok to do so.
# [1.26.0](v1.25.0...v1.26.0) (2023-08-31) ### Features * add get_all_roles_by_domain api ([#316](#316)) ([22507ca](22507ca))
🎉 This PR is included in version 1.26.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
refer to: casbin/casbin#1190