wiki:BlackMagicTicketTweaksPlugin

Functions to alter Ticket form behaviour and Ticket Permissions

Notice: This plugin is deprecated in Trac 1.4 and later. It uses the deprecated ITemplateStreamFilter.

Description

Trac 0.11 provides developers and administrators with the ability to apply Genshi Transformers to the templates before they are presented to the user. This plugin adds the ability to tweak any of the Ticket fields, be they custom or standard, in the following ways:

  • disable - The field won't be editable.
  • hide - The field will be invisible to the user.
  • label - Rename a field, in particular one of the built-in fields.
  • notice - Add a small notice below a field.
  • tip - Provide a tooltip when the control hovers over the field. Useful for example to give people a reminder for the difference between 'priority' and 'severity'.
  • permission - Set a permission that is required to edit that specific field. This is particularly useful in an environment where you let users set severity, so they need TICKET_CHGPROP, but you only want certain people to be able to edit the Priority.

An example of the configuration that highlights to the user the difference between 'severity' and 'priority':

[blackmagic]
permissions = MASTER_OF_PERMISSIONS, TICKET_RAISE_DEFECT
tweaks = severity, priority
priority.tip = The priority is the Project-defined importance of the issue, and in general the order in which things will tend to be done.
severity.tip = The severity is how important this issue is to the customer or you.
priority.permission = MASTER_OF_PERMISSIONS
ticket_type.defect = TICKET_RAISE_DEFECT
ticket_type.task = TICKET_ADMIN

The plugin also lets you define arbitrary permissions, say MASTER_OF_PRIORITIES, if you want to require someone to have such a custom permission to edit a certain field.

The plugin can also deny access to certain ticket types by permissions using the ticket_type ini setting. See below for configuration settings.

Bugs/Feature Requests

Existing bugs and feature requests for BlackMagicTicketTweaksPlugin are here.

If you have any issues, create a new ticket. Please cc yourself if you're anonymous or you won't be notified of when I respond.

defect

53 / 53

enhancement

20 / 21

task

1 / 1

Download

Download the zipped source from here.

Source

You can check out BlackMagicTicketTweaksPlugin from here using Subversion, or browse the source with Trac.

Installation

The easiest way to install the BlackMagicTicketTweaksPlugin is to point pip at the t-h.o SVN repository, such as:

pip install svn+https://trac-hacks.org/svn/blackmagictickettweaksplugin/0.12

Alternatively, you may download the source and go into the Trac 0.11 directory and then run:

python setup.py install

After you have installed the BlackMagicTicketTweaksPlugin, you must enable it. You can do so in the Administration panel of Trac, or in the trac.ini file by adding:

[components]
blackmagic.* = enabled

Configuration

Any fields that you would like to tweak with this plugin must be listed in the tweaks option of the [blackmagic] section in your TracIni. This list is comma-separated and lower case. For example:

[blackmagic]
tweaks = cc, priority, severity

Next you must specify all the actions that you want performed on those fields. You can have as many actions as you like.

The actions are specified as <field>.<action> = <value>:

[blackmagic]
tweaks = priority
priority.permission = TRAC_ADMIN

The following are considered True settings in trac.ini:

  • true
  • yes
  • on
  • 1

They are all case insensitive.

The following actions are supported:

disable
If True, the field will be present and its value shown but it won't be editable. By default the label will be striked out, but if you set the gray_disabled option to some value, that color will be used instead. Suggested value is #cccccc.
hide
If True, the field will be completely removed and so not settable and invisible.
label
The label for the field will be renamed to this value. Not useful for the custom fields, but it lets you adjust the default fields names.
notice
Adds a small notice under the field; useful for annotations on the field.
tip
If the mouse hovers over the field, a little tooltip will pop up offering some explanation. Javascript must be enabled for this to work.
permission
A comma-separated list of permissions that the user must have at least one of to edit this field. If they do not, the field will be disabled (as above). This allows per-field permissions.
ondenial
This only means something on a field with a permission action set. In this case, it determines how to handle if the user has no such permission. Valid options are either 'disable' (default) or 'hide', both treated as if the field had such an action set as above.

You may create new permissions in Trac for use above (or anywhere you like) by specifying the permission option, as in:

[blackmagic]
permissions = TICKET_CHG_PRIORITY, TICKET_CHG_CC

This feature is also available in the Trac core as of 0.12, see TracPermissions#CreatingNewPrivileges for more details.

To deny access to a ticket type by permission use the following options:

ticket_type.* = PERMISSION replacing * with the ticket type, for example defect. So to only allow users with the TICKET_MODIFY permission access to defect tickets you would set the following:

[blackmagic]
ticket_type.defect = TICKET_MODIFY

Denying access to a ticket type will prevent users from seeing them in reports, viewing the tickets of that type and creating tickets of that type.

The ticket_type.* option can only hold one permission.

To use this option you will need to add BlackMagicTicketTweaks to the permission_policies option in the [trac] section of the trac.ini file:

[trac]
permission_policies =  BlackMagicTicketTweaks, DefaultPermissionPolicy

Recent Changes

17905 by rjollos on 2020-12-04 00:46:32
TracBlackMagicTicketTweaks 0.12.4: Change plugin name
17699 by rjollos on 2020-04-28 23:39:50
BlackMagicTicketTweaks 0.12.3: Use imports from Trac rather than Genshi
17127 by rjollos on 2018-04-16 08:37:44
BlackMagicTicketTweaks 0.12.3: Remove implements IPermissionStore

The plugin does not actually implement the
IPermissionStore interface.

(more)

Author/Contributors

Author: ixokai
Maintainer: none (deprecated)
Contributors: obs

Last modified 3 years ago Last modified on Dec 3, 2020, 4:32:10 AM