TFS Work Item type - Access to field based on rights
I have a problem if user is not in either of the groups it will fail and blank display disabled field. How do i define these permissions?
My definition of field is below.
<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
<REQUIRED />
<DEFAULT from="value" value="Requested" />
<ALLOWEDVALUES>
<LISTITEM value="Approved" />
<LISTITEM value="Requested" />
<LISTITEM value="Rejected" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="Requested" />
<READONLY not="[TEAM FOUNDATION]\Approvers" />
<READONLY not="[TEAM FOUNDATION]\Developers" />
<HELPTEXT>Shows whether the 开发者_StackOverflowtask has been approved by management.</HELPTEXT>
</FIELD>
This seems like a heavy one.What is your exact intend? Maybe using a WHEN block or splitting the restrictions into basic ones (at the field definition) and special ones at state or transition level will solve your problem?
<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
<REQUIRED />
<DEFAULT from="value" value="Requested" />
<WHENNOT field="System.State" value="New">
<READONLY not="[TEAM FOUNDATION]\Developers"/>
<READONLY not="[TEAM FOUNDATION]\Approvers"/>
</WHENNOT>
<HELPTEXT>Shows whether the task has been approved by management.</HELPTEXT>
</FIELD>
or
<FIELD name="Approval" refname="Approval" type="String" reportable="dimension">
<REQUIRED />
<ALLOWEDVALUES>
<LISTITEM value="Approved" />
<LISTITEM value="Requested" />
<LISTITEM value="Rejected" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="Requested" />
<HELPTEXT>Shows whether the task has been approved by management.</HELPTEXT>
</FIELD>
<TRANSITION from="" to="New">
<FIELDS>
<FIELD refname="Approval">
<READONLY not="[TEAM FOUNDATION]\Developers"/>
<READONLY not="[TEAM FOUNDATION]\Approvers"/>
</FIELD>
</TRANSITION>
By the way: You should refName your fields with a whole "Namespace", e.g. "My.Company.TfsFields.Common.Approval" or "My.Company.TfsFields.Bugs.IsRegression"
精彩评论