Merge lp:~max-rabkin/ibid/perms-705860 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Max Rabkin
Status: Merged
Approved by: Max Rabkin
Approved revision: 925
Merged at revision: 996
Proposed branch: lp:~max-rabkin/ibid/perms-705860
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 32 lines (+9/-6)
1 file modified
ibid/plugins/__init__.py (+9/-6)
To merge this branch: bzr merge lp:~max-rabkin/ibid/perms-705860
Reviewer Review Type Date Requested Status
Stefano Rivera Approve
marcog (community) Approve
Review via email: mp+47038@code.launchpad.net

This proposal supersedes a proposal from 2011-01-21.

Commit message

Enforce permissions on non-@match handlers

To post a comment you must log in.
Revision history for this message
marcog (marco-gallotta) wrote : Posted in a previous version of this proposal

> + if (not getattr(method, 'auth_required', False)

How about if getattr(method, 'auth_required', True)?

review: Needs Fixing
Revision history for this message
marcog (marco-gallotta) wrote : Posted in a previous version of this proposal

Arg, ignore that. It's wrong sorry.

review: Approve
Revision history for this message
marcog (marco-gallotta) :
review: Approve
Revision history for this message
Stefano Rivera (stefanor) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/__init__.py'
2--- ibid/plugins/__init__.py 2010-11-07 15:11:39 +0000
3+++ ibid/plugins/__init__.py 2011-01-21 13:51:16 +0000
4@@ -132,19 +132,22 @@
5
6 found = False
7 for method in self._get_event_handlers():
8+ args = None
9 if not hasattr(method, 'pattern'):
10 found = True
11- method(event)
12+ args = ()
13 elif hasattr(event, 'message'):
14 found = True
15 match = method.pattern.search(
16 event.message[method.message_version])
17 if match is not None:
18- if (not getattr(method, 'auth_required', False)
19- or auth_responses(event, self.permission)):
20- method(event, *match.groups())
21- elif not getattr(method, 'auth_fallthrough', True):
22- event.processed = True
23+ args = match.groups()
24+ if args is not None:
25+ if (not getattr(method, 'auth_required', False)
26+ or auth_responses(event, self.permission)):
27+ method(event, *args)
28+ elif not getattr(method, 'auth_fallthrough', True):
29+ event.processed = True
30
31 if not found:
32 raise RuntimeError(u'No handlers found in %s' % self)

Subscribers

People subscribed via source and target branches