Hi,

I setup a variant of ReadonlySignedTickets on our test system and worked.
On our production system as soon as I add the plugin as permission policy I 
receive a runtime error when using the timeline function: RuntimeError: 
maximum recursion depth exceeded while calling a Python object

Single-file plugin code:

author = "xxxx"

from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket

class XxxxxxReadonlyTicketsPlugin(Component):
        implements(IPermissionPolicy)

        def check_permission(self, action, username, resource, perm):
                if resource is None or resource.realm != 'ticket' or \
                   resource.id is None or \
                   action in ['TICKET_VIEW', 'TICKET_APPEND'] or \
                   action == 'TICKET_ADMIN' or 'TICKET_ADMIN' in perm:
                        return None

                t = Ticket(self.env, resource.id)
                if t['status'] == 'closed' and t['type'] == 'review':
                        return False

Current permession policy setup:
permission_policies = PrivateWikiSystem, PrivateTicketsPolicy, 
AttachmentDeletePolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy

I tested adding the plugin as first policy entry and right before 
"DefaultPermissionPolicy" with the same runtime error.


Does anybody have an idea?


Am Mittwoch, 20. Juli 2016 09:49:02 UTC+2 schrieb Florian Schricker:
>
>
> Hi Ryan,
>
>
> thanks for picking up the question!
>
>
> Am Dienstag, 19. Juli 2016 16:53:43 UTC+2 schrieb RjOllos:
>>
>>
>> On Tuesday, July 19, 2016 at 6:43:54 AM UTC-7, Florian Schricker wrote:
>>>
>>> I am uncertain whether this is possible at all so I am asking here: I 
>>> would like to disable modifying the ticket description when the ticket is 
>>> in a given state while still allowing commenting. Can anything like this be 
>>> configured in a workflow?
>>>
>>
>> 1. BlackMagicTicketsPlugin (1) allows a permission to be specified to 
>> edit a ticket field. 
>>
> 2. ExtraPermissionsProvider (2) allow you to define new permissions.
>>
> 3. A permissions policy could be implemented, similar to 
>> ReadonlySignedTickets (3), to deny a permission when the ticket is in a 
>> particular state.
>>
>> Putting those three things together, I think it might work to define a 
>> new permission for editing the ticket description, and deny the permission 
>> when the ticket is in a particular state.
>>
>> (1) https://trac-hacks.org/wiki/BlackMagicTicketTweaksPlugin 
>> (2) https://trac.edgewall.org/wiki/TracPermissions#CreatingNewPrivileges
>> (3) 
>> https://trac.edgewall.org/wiki/CookBook/Configuration/SignedTickets#Readonlylogic
>>
>  
> From looking at ReadonlySignedTickets I am wondering if this plugin would 
> not suffice already:
>
>    - Using the "Allow ticket comments" variation (basically enabling 
>    permission TICKET_APPEND again commenting would be enabled, but not 
>    modifying the description (TICKET_MODIFY required, no?).
>    - Enhancing the lines "if t['status'] == 'closed' and t['resolution'] 
>    == 'signed': return False" with the actual ticket states I am having 
>    here in my setup would do the rest. There would be no configuration via 
>    trac.ini but I can do without.
>
> I think I'll give it a go, thanks again for these good pointers to actual 
> solutions!!
> Florian
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to