Limiting TFS Workitem 'Assigned To' values based on role
I decided I should cross post this information. I often times do not blog a lot of the technical things I come across or dish out to others, whether it be correct or incorrect. I'm trying to change that. In that spirit I thought I would cross post this information from the MSDN forums.
The Problem Statement:
As part of defect workflow a bug type task is to be modified to meet the following criteria:
- Testers can only assign defects to Dev Leads
- PMs, Developers, and Dev Leads can assign defects to any other developer
Missing Requirements:
What is not part of the problem statement is the case in which Developers and Dev Leads can assign a defect to Testers in order to collect more informatio, or to have a resolved defect tested and closed. There are some additional scenarios of that nature. The problem statement represents what the user in the forum asked for.
My Proposed Solution: (not the only way to skin the cat)
It gets difficult to make rules involving such granularity through the standard XML schema definition but you could actually accomplish the specific scenario you mentioned with some creative group stucturing and creative rules.
If we create the following groups
And set the groups up as following in their memberships
- Devs
- Leads
- PMs
- Testers
- DevAssigners
- LeadAssigners
- DefectAssignees
*Defects need to be able to be assigned to testers for closing and also if the defect is logged with too little info etc. The lead or PM may wish to assign it back to a tester for additional information.
Let's say in the Field definition you set something up like this so that the field is readonly to all users but DevAssigners unless specified in a specific transition or state rule. Even in the case of DevAssigners they can only assign a defect to DefectAssignees
<FIELD name="Assigned To" refname="System.AssignedTo" type="String">
<HELPTEXT>
The person assigned to act on the bug, either to fix it or to verify the fix
</HELPTEXT>
<REQUIRED />
<READONLY not="[Project]\DevAssigners"/>
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[Project]\DefectAssignees" />
</ALLOWEDVALUES>
...
</FIELD>
In the <TRANSITION> sections we'll set that from '' to 'Submitted' that all LeadAssigners can assign the bug and only assign to 'Leads'
It would look like the following
<TRANSITION from="" to="Submitted">
<REASONS>...</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<READONLY not="[Project]\LeadAssigners" />
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[Project]\Leads" />
</ALLOWEDVALUES>
</FIELD>
...
</FIELDS>
</TRANSITION>
From"Submitted" to "Resolved" and the other appropriate transitions in which now only 'DevAssigners' can only assign to 'DefectAssignees' It would look like this:
<TRANSITION from="Submitted" to="Resolved">
<REASONS>...</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<READONLY not="[Project]\DevAssigners" />
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[Project]\DefectAssignees" />
</ALLOWEDVALUES>
</FIELD>
...
</FIELDS>
</TRANSITION>
There are other transitions in which you want to apply similar rules. This is only one way to get to the result. But in essence most will have to look something like this.
I have not tested the exact situation above I just did this from memory but have put into place numerous times very similar situations based on a defect lifecycle.
Hope this helps.
Technorati tags:
TFS,
Workitem