Unanswered Restrict work item fields to specific users in TFS 2010

  • Wednesday, January 18, 2012 9:13 PM
     
      Has Code

    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>
    
    

    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. Any ideas?

     

All Replies

  • Thursday, January 19, 2012 12:29 AM
     
     

    Use READONLY element with for attribute set to John's account.

    See: http://msdn.microsoft.com/en-us/library/aa337590(v=vs.80).aspx

    See also: http://stackoverflow.com/questions/4374965/tfs-2010-setting-a-work-item-field-readonly-for-all-users-excepting-administrat


    VS ALM MVP - http://blog.ognjenbajic.com TeamCompanion for Outlook 4.3 - agile project management with team support! www.teamcompanion.com
  • Thursday, January 19, 2012 3:07 PM
     
      Has Code

    @Ognjen, yes but this way you cannot use field expressions to dynamically select a user. It seams that there is only a way to block/permit access to field to groups and not single users taken from a field, for example System.CreatedBy which is the creator of the actual work item. Is there any way I can fetch the field's content dynamically to put them in the for/not attributes of <READONLY> ?

    <FIELD name="Project Manager" refname="Custom.ProjectManager" type="String" reportable="dimension">
    	<HELPTEXT>The name of the project manager.</HELPTEXT>
    	<SUGGESTEDVALUES expanditems="true" filteritems="excludegroups">
    	  <LISTITEM value="[global]\Project managers" />
    	</SUGGESTEDVALUES>
        <READONLY for="[global]\Project managers" not="[global]\System administrators" />
    </FIELD>