| 23 | |
| 24 | == Basic Configurable Workflow == |
| 25 | Basic workflow configuration is possible in TracIni through two new sections, |
| 26 | `ticket-status` and `ticket-actions`. This configurability is limited to defining |
| 27 | ticket actions and status states and their transitions with basic permission |
| 28 | enforcement. |
| 29 | |
| 30 | === Defining available actions for a status === |
| 31 | Each key under the `ticket-status` section is a ticket status and the value associated with each key is the actions available. |
| 32 | |
| 33 | {{{ |
| 34 | [ticket-status] |
| 35 | assigned = leave resolve reassign |
| 36 | closed = leave reopen retest |
| 37 | new = leave resolve reassign accept |
| 38 | reopened = leave resolve reassign |
| 39 | resolved = leave reassign reopen verify |
| 40 | verified = leave reassign reopen retest close |
| 41 | }}} |
| 42 | |
| 43 | === Mapping actions to resulting statuses === |
| 44 | |
| 45 | The `ticket-actions` section defines what the status resulting from an action |
| 46 | will be, in addition to the permission required for that action. |
| 47 | |
| 48 | {{{ |
| 49 | [ticket-actions] |
| 50 | accept = assigned |
| 51 | close = closed |
| 52 | close.permission = TRAC_ADMIN |
| 53 | reassign = new |
| 54 | reopen = reopened |
| 55 | reopen.permission = TICKET_ADMIN |
| 56 | resolve = resolved |
| 57 | retest = resolved |
| 58 | retest.permission = TICKET_ADMIN |
| 59 | verify = verified |
| 60 | }}} |
| 61 | |
| 62 | == Plugabble Workflow == |
| 63 | For more complex ticket workflow requirements an extension point is available, |
| 64 | allowing full control of the ticket workflow process. |
| 65 | |
| 66 | {{{ |
| 67 | #!python |
| 68 | class ITicketWorkflow(Interface): |
| 69 | """ This interface controls what actions can be performed on a ticket and |
| 70 | also a list of the available ticket fields. """ |
| 71 | |
| 72 | # Control ticket actions |
| 73 | def get_ticket_actions(req, ticket): |
| 74 | """ Return the actions that are available given the current state of |
| 75 | ticket and the request object provided. """ |
| 76 | |
| 77 | def get_ticket_action(req, ticket, action): |
| 78 | """ Return a trac.ticket.field.Field object for ticket action. """ |
| 79 | |
| 80 | def apply_ticket_action(req, ticket, action): |
| 81 | """ Perform action on ticket. """ |
| 82 | |
| 83 | # Control ticket fields |
| 84 | def filter_ticket_fields(req, ticket, fields): |
| 85 | """ Given a list of ticket.Field objects and a ticket, return the |
| 86 | filtered list of fields. This method must enforce permission |
| 87 | control on all fields. """ |
| 88 | |
| 89 | def update_ticket_fields(req, ticket): |
| 90 | """ Apply changes in req to ticket. By default this should simply be |
| 91 | `ticket.populate(req.args)`. """ |
| 92 | }}} |