我想通过代码检查用户是否具有TFS 2010 Project的访问权限。我只知道他的用户名,我不知道他的TFS 2010密码。这段代码应该适用于我要求的任何用户。我应该返回true或false,true表示给定用户具有TFS 2010访问项目的访问权限。以下代码适用于我知道密码的用户。我需要这个适用于任何用户。请帮帮我
Dim ProjectName As String = "ProjectName"
Dim icp As ICredentialsProvider = New UICredentialsProvider
Dim ncred As NetworkCredential = New NetworkCredential("Username", "password", "domain")
TFS = New TeamFoundationServer(Server, ncred, icp)
store = CType(TFS.GetService(GetType(WorkItemStore)), WorkItemStore)
Dim Project As Project
If store.Projects.Count >= 0 Then
For Each Project In store.Projects
If Project.Name = ProjectName Then
If Project.HasWorkItemWriteRights = True Or Project.HasWorkItemReadRights = True Then
Console.WriteLine("User have permissions")
End If
End If
Next
End If
答案 0 :(得分:0)
您可以获取用户列表:
Image
然后迭代列表,并检查每个用户是否存在于列表中。