Joh*_*ers 4 security tfs tfs2010
从我的答案,看看如何添加Windows组作为"读者"在TFS 2010集合中的所有项目?这必须手动完成所有现有项目.
是否有可用于执行此操作的命令行工具?我知道TfsSecurity计划,但我尝试为单个团队项目执行此操作并不起作用.
我为一个团队项目做了什么:
tfssecurity/collection:http:// tfs:8080/tfs/defaultcollection/a + Project vstfs:/// Classification/TeamProject/guid GENERIC_READ"[DefaultCollection]\All Project Read-Only Users"ALLOW
这确实为该团队项目添加了该组的ACL,但该组未显示在团队项目的"安全性"对话框中.
我想要做的是为该团队提供与团队项目的"读者"组相同的访问权限.
这是一个powershell脚本,用于迭代集合中的每个团队项目,获取Readers组并添加SID.
# load the required dll
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
function get-tfs
{
param(
[string] $serverName = $(throw 'serverName is required')
)
$propertiesToAdd = (
('VCS', 'Microsoft.TeamFoundation.VersionControl.Client', 'Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer'),
('WIT', 'Microsoft.TeamFoundation.WorkItemTracking.Client', 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore'),
('CSS', 'Microsoft.TeamFoundation', 'Microsoft.TeamFoundation.Server.ICommonStructureService'),
('GSS', 'Microsoft.TeamFoundation', 'Microsoft.TeamFoundation.Server.IGroupSecurityService')
)
[psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName)
foreach ($entry in $propertiesToAdd) {
$scriptBlock = '
[System.Reflection.Assembly]::LoadWithPartialName("{0}") > $null
$this.GetService([{1}])
' -f $entry[1],$entry[2]
$tfs | add-member scriptproperty $entry[0] $ExecutionContext.InvokeCommand.NewScriptBlock($scriptBlock)
}
return $tfs
}
#set the TFS server url
[psobject] $tfs = get-tfs -serverName http://YourTfsServer:8080/tfs/YourColleciton
$items = $tfs.vcs.GetAllTeamProjects( 'True' )
$items | foreach-object -process {
$proj = $_
$readers = $tfs.GSS.ListApplicationGroups($proj.Name) | ?{$_.DisplayName -eq 'Readers' }
$tfs.GSS.AddMemberToApplicationGroup($readers.Sid, 'TheSidToTheGroupYouWantToAdd')
}
Run Code Online (Sandbox Code Playgroud)
小智 5
我的方法基于以下事实:除非明确拒绝,否则继承TFS权限.
要创建一个将自动访问所有现有项目以及期货项目的只读权限的用户组,请按照下列步骤操作:
在项目集合级别创建新的安全组.您可以使用"团队/团队项目集合设置/组成员资格"菜单在Visual Studio中执行此操作.
将新组添加为"Project Collection Administrators"组的成员.这将授予对集合中所有项目的访问权限,包括期货项目.
限制新组的权限以删除继承的管理员权限.要强制进行只读访问,请拒绝除"创建工作区","查看构建资源"和"查看集合级别信息"之外的所有权限.
该组的用户将具有对集合中所有项目的源代码,工作项和构建定义的读取权限.
归档时间: |
|
查看次数: |
10200 次 |
最近记录: |