forked from edgewall/trac
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.12.1dev: the permission check for viewing a ticket comment must be …
…done on the ticket //resource//. Also added a development plugin which can be useful for quickly spotting similar mistakes during testing. Fixes #9669. git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/0.12-stable@10194 af82e41b-90c4-0310-8c96-b1721e28e2e2
- Loading branch information
cboos
committed
Oct 6, 2010
1 parent
34e9362
commit 27caf0b
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
from trac.core import * | |||
from trac.perm import IPermissionPolicy, PermissionCache | |||
from trac.resource import Resource | |||
|
|||
revision = "$Rev$" | |||
url = "$URL$" | |||
|
|||
class DebugPolicy(Component): | |||
"""Verify the well-formedness of the permission checks. | |||
**This plugin is only useful for Trac Development.** | |||
Once this plugin is enabled, you'll have to insert it at the appropriate | |||
place in your list of permission policies, e.g. | |||
{{{ | |||
[trac] | |||
permission_policies = DebugPolicy, SecurityTicketsPolicy, AuthzPolicy, | |||
DefaultPermissionPolicy, LegacyAttachmentPolicy | |||
}}} | |||
""" | |||
|
|||
implements(IPermissionPolicy) | |||
|
|||
# IPermissionPolicy methods | |||
|
|||
def check_permission(self, action, username, resource, perm): | |||
if resource: | |||
assert resource is None or isinstance(resource, Resource) | |||
assert isinstance(perm, PermissionCache) | |||
self.log.info("does '%s' have %s on %r?", username, action, resource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters