Modify

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#128 closed enhancement (fixed)

Have the behaviour of DefaultTicketActionController be configurable through trac.ini?

Reported by: Alec Thomas Owned by: Alec Thomas
Priority: normal Component: WorkFlowPatch
Severity: normal Keywords:
Cc: Trac Release:

Description

The action table in get_ticket_actions() could be somehow configurable, although I'm not convinced it is 100% useful given that you would need code anyway to deal with the actions in all but the simplest of cases.

Attachments (0)

Change History (4)

comment:1 Changed 11 years ago by Alec Thomas

What could also be useful is being able to configure the permission map through trac.ini.

comment:2 Changed 11 years ago by Alec Thomas

Perhaps something like the following:

[ticket_actions]
new = leave resolve reassign accept
assigned = leave resolve reassign
reopened = leave resolve reassign
resolved = leave reassign reopen verify
verified = leave reassign reopen retest close
closed = leave reopen retest

[ticket_permissions]
resolve = TICKET_MODIFY and ROLE_DEVELOPER
reassign = TICKET_CHGPROP
accept = TICKET_CHGPROP and ROLE_DEVELOPER
reopen = TICKET_CREATE and ROLE_QA
verify = TICKET_CHGPROP and ROLE_QA
retest = ROLE_RELEASE
close = TICKET_CHGPROP and (ROLE_QA or ROLE_RELEASE)

comment:3 Changed 11 years ago by Alec Thomas

The only issue with that is it would require a small expression parser, but it might be worth the effort for generality.

comment:4 Changed 11 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

This has been implemented in the Trac sandbox. The format of the configuration file is:

[ticket-status] [[BR]]
<status> = <action> <action> <action> [[BR]]
<status> ... [[BR]]

[ticket-actions] [[BR]]
<action> = <status> [[BR]]
<action>.permission = <permission>

All entries are optional and, if they do not exist, the default Trac values apply.

If a status or action is referenced, but does not exist either in the configuration file or Trac, an exception is thrown.

eg. To implement the basics of the trac:NewWorkflow proposal:

[ticket-status]
new = leave resolve reassign accept
assigned = leave resolve reassign
reopened = leave resolve reassign
resolved = leave reassign reopen verify
verified = leave reassign reopen retest close
closed = leave reopen retest

; Permissions and status states for each action
[ticket-actions]
accept = assigned
resolve = resolved
reassign = new
reopen = reopened
reopen.permission = TICKET_ADMIN
retest = resolved
retest.permission = TICKET_ADMIN
verify = verified
retest.permission = TICKET_ADMIN
close = closed
close.permission = TRAC_ADMIN

One caveat is that if new status states are created, they will not be available in the custom query page. I could possibly make the DefaultTicketWorkflow class automatically add new trac.ticket.model.Status objects, though this may not be desirable and there's no real way to clean them up.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.