-
Notifications
You must be signed in to change notification settings - Fork 8
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
Always trigger event and provide userid #14
Conversation
LGTM |
Sounds fine to me :-) FWIW, I don't have any production code using this library anymore, I'd be very happy to divest maintainership responsibility to you guys so you don't feel like you need to ping me in PRs. (I'm happy to be pinged of course, just don't want to slow you down if I don't have to) |
@@ -37,10 +37,11 @@ def track_policy(event): | |||
print("We selected policy %s" % event.policy) | |||
|
|||
""" | |||
def __init__(self, policy, request): | |||
def __init__(self, policy, request, userid): |
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.
Changing this changes the API in an incompatible way. We might want to have this default to None
.
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.
We can indeed (I will), although nobody is supposed to instantiate those events :)
Thanks for that Ryan! In this particular case, it was relevant to require your approval, because we weren't 100% confident about the changes :) |
88e4149
to
e95d339
Compare
Always trigger event and provide userid
When the selected policy event is notified, it is very useful to have the authenticated userid at hand.
This PR provides it.
Also, this PR fixes a «bug» about the event not being always triggered.
Indeed, for the permissions Pyramid calls
effective_principals()
which also callsauthenticated_userid()
of every contained policy. Whereas the event was sent whenauthenticated_userid()
was called explicitly, it wasn't sent when onlyeffective_principals()
was called.@almet @rfk r?