Edgewall Software

Ticket #7201 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

PermissionCache doesn't cache when created with __call__

Reported by: Stephen Compall <stephen.compall@…> Owned by: cboos
Priority: highest Milestone: 0.11
Component: general Version: 0.11rc1
Severity: minor Keywords: permission patch
Cc:

Description

Discovered in my logs after a user report:

2008-05-06 19:37:35,544 Trac[perm] DEBUG: No policy allowed <redacted> performing TICKET_MODIFY on <Resource 'ticket'>
(repeat 18 times with different timestamps)

I have an IPermissionPolicy that requests actions on perm('ticket') to find them for perm('ticket', id), and then performs an expensive test when that answers false, hence creating the performance issue reported by my user for viewing a single ticket (besides being called multiple times in the first place).

As I see it, the issue is:

>>> cache = {}
>>> cache is not None and cache or 0
0

(i.e. {} is false) and is fixed in the attached patch.

Attachments

perm-share-empty-cache.diff (0.5 KB) - added by Stephen Compall <stephen.compall@…> 7 months ago.
patch against r7021 (tried on 0.11rc1)

Change History

Changed 7 months ago by Stephen Compall <stephen.compall@…>

patch against r7021 (tried on 0.11rc1)

Changed 7 months ago by cboos

  • keywords permission added
  • owner changed from jonas to cboos
  • priority changed from normal to highest
  • status changed from new to assigned
  • milestone set to 0.11

Oops, right, good catch!

Changed 7 months ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Patch applied in r7022, with some unit-tests.

Getting the unit-tests to work implied disabling the cache at the level of the DefaultPermissionPolicy, which makes me think that cache could eventually lead to transient permission issues (like an admin complaining that the removal of a permission for anonymous didn't take effect immediately - ok, it's a matter of waiting 5 seconds, so nothing critical).

Add/Change #7201 (PermissionCache doesn't cache when created with __call__)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.