Skip to content
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

Merged
merged 3 commits into from
Feb 11, 2016
Merged

Conversation

leplatrem
Copy link
Contributor

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 calls authenticated_userid() of every contained policy. Whereas the event was sent when authenticated_userid() was called explicitly, it wasn't sent when only effective_principals() was called.

@almet @rfk r?

@Natim
Copy link
Contributor

Natim commented Feb 10, 2016

LGTM

@rfk
Copy link
Contributor

rfk commented Feb 10, 2016

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):
Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

@leplatrem
Copy link
Contributor Author

Thanks for that Ryan!

In this particular case, it was relevant to require your approval, because we weren't 100% confident about the changes :)

@leplatrem leplatrem force-pushed the provide-userid-event branch from 88e4149 to e95d339 Compare February 11, 2016 13:19
leplatrem added a commit that referenced this pull request Feb 11, 2016
Always trigger event and provide userid
@leplatrem leplatrem merged commit 8904c16 into master Feb 11, 2016
@leplatrem leplatrem deleted the provide-userid-event branch February 11, 2016 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants