IAuthorizationService.AddAccessControlEntry Method
Adds an ACE to an object's ACL.
Namespace: Microsoft.TeamFoundation.Server
Assembly: Microsoft.TeamFoundation (in microsoft.teamfoundation.dll)
Assembly: Microsoft.TeamFoundation (in microsoft.teamfoundation.dll)
Sample code to modify settings for Projects
I found that getting the objectId is a pain. Here's some help when setting AccessControlEntry on a project level and site level.
privatevoid AddBuildPermission(TeamFoundationServer server, string projectName)
privatevoid AddBuildPermission(TeamFoundationServer server, string projectName)
{
ICommonStructureService structure = (ICommonStructureService)server.GetService(typeof(ICommonStructureService)); IAuthorizationService authorizationService = (IAuthorizationService)server.GetService(typeof(IAuthorizationService)); IGroupSecurityService groupSecurityService =(IGroupSecurityService)server.GetService(typeof(IGroupSecurityService)); ProjectInfo projectInfo = structure.GetProjectFromName(projectName); foreach (Identity applicationGroup in groupSecurityService.ListApplicationGroups(projectInfo.Uri)){
AccessControlEntry administerABuild = newAccessControlEntry("ADMINISTER_BUILD", applicationGroup.Sid, true);authorizationService.AddAccessControlEntry(
"$Project:" + projectInfo.Uri, administerABuild);}
}
to modify access at the server level use "$NAMESPACE" instead of "$Project:" + projectInfo.Uri in AddAccessControlEntry
- 7/23/2008
- mwestphal