3

I am using TFS 2010 and I am customizing a work item type. I was wondering, if there is a way to restrict access to fields to users that are members of a group such as:

<FIELD name="Created By" refname="System.CreatedBy" type="String" syncnamechanges="true" reportable="dimension" />

<FIELD name="Project Manager" refname="CustomField.ProjectManager" type="String" reportable="dimension">
    <HELPTEXT>The name of the project manager.</HELPTEXT>
    <SUGGESTEDVALUES expanditems="true" filteritems="excludegroups">
        <LISTITEM value="[global]\Project Managers" />
    </SUGGESTEDVALUES>
    <WHENNOT field="System.CreatedBy" value="CustomField.ProjectManager">
        <READONLY />
    </WHENNOT>
</FIELD>

EDIT Is there a way to restrict a specific user inside a group, for instance: Restrict project manager "John" from changing the field because that work item is not his project, but permit project manager "Jane" to change it because it is her project?

The problem with the code above is that the value attribute only accepts a string value and does not recognize a field expression.

2 Answers 2

0

I have concluded that you cannot do this. Until I am proved wrong, this is not supported using TFS 2010.

-1

Not tried this myself, but you should be able to edit this in the work item template (I assume you've already gotten that far since you've pasted some XML from it :)? If not it's under the Tools > Process Editor menu) using the VALIDUSER element in your FIELD, see http://msdn.microsoft.com/en-us/library/aa337606(v=vs.90).aspx.

4
  • No that requires that a field's value is a Valid TFS username. (As opposed to a random string).
    – DaveShaw
    Jan 18, 2012 at 13:21
  • In that case is the documentation wrong? It states "VALIDUSER is an optional child element of FIELD (Work Item Type Definition Schema), FIELD (WORKITEMTYPE Element), WHENCHANGED, and WHENNOTCHANGED. If you do not define one of the optional attributes, all valid Team Foundation Server users and groups will be able to modify the field." Jan 18, 2012 at 13:37
  • "If you do not define one of the optional attributes, all valid Team Foundation Server users and groups will be able to modify the field." relates to the "for", "not" and "group" attributes of the VALIDUSER element, this is no different than the question above.
    – DaveShaw
    Jan 18, 2012 at 14:19
  • Can you do this: <VALIDUSER group="groupName" for="System.CreatedBy" /> ? In other words, can you provide a dynamic userName, here the creator of the work item ? Jan 18, 2012 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.