This topic has not yet been rated - Rate this topic

IAuthorizationService.AddAccessControlEntry Method

Adds an ACE to an object's ACL.

Namespace: Microsoft.TeamFoundation.Server
Assembly: Microsoft.TeamFoundation (in microsoft.teamfoundation.dll)

void AddAccessControlEntry (
	string objectId,
	AccessControlEntry ace
)
void AddAccessControlEntry (
	String objectId, 
	AccessControlEntry ace
)
function AddAccessControlEntry (
	objectId : String, 
	ace : AccessControlEntry
)

Parameters

objectId

The unique object identifier supplied by the caller. A URI (for artifacts) or a GUID (for all other objects) is recommended.

ace

The access control entry to be added.

If ace.Inherited is set to True, calling this method has no effect.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
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)

{

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