Edgewall Software

Changes between Version 11 and Version 12 of CookBook/Configuration/SignedTickets


Ignore:
Timestamp:
May 8, 2017, 12:30:51 AM (21 months ago)
Author:
Ryan J Ollos
Comment:

Simplify by having permission policy define the permission.

Legend:

Unmodified
Added
Removed
Modified
  • CookBook/Configuration/SignedTickets

    v11 v12  
    1313
    1414== Steps
    15 
    16 === TICKET_SIGN permission
    17 
    18 Enable the optional component [TracPermissions#CreatingNewPrivileges ExtraPermissionsProvider] and configure a new permission:
    19 {{{#!ini
    20 [extra-permissions]
    21 _perms = TICKET_SIGN
    22 }}}
    2315
    2416=== Signed Resolution
     
    5749
    5850from trac.core import *
    59 from trac.perm import IPermissionPolicy
     51from trac.perm import IPermissionPolicy, IPermissionRequestor
    6052from trac.resource import ResourceNotFound
    6153from trac.ticket.model import Ticket
     
    6456class ReadonlySignedTickets(Component):
    6557
    66     implements(IPermissionPolicy)
     58    implements(IPermissionPolicy, IPermissionRequestor)
    6759
    6860    allowed_actions = ('TICKET_VIEW',)
     61
     62    # IPermissionRequestor methods
     63
     64    def get_permission_actions(self):
     65        return ['TICKET_SIGN']
     66
     67    # IPermissionPolicy methods
    6968
    7069    def check_permission(self, action, username, resource, perm):