Questa me la devo segnare: per scoprire se un utente di TFS fa parte del gruppo "Team Foundation Administrators" si può fare così:
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
public
virtual
bool IsAdminUser(TeamFoundationServer tfs)
{
IGroupSecurityService gss = (IGroupSecurityService)m_tfServer.GetService(typeof(IGroupSecurityService));
Identity userIdentity = this.TFS.AuthenticatedUserIdentity;
Identity groupIdentity = gss.ReadIdentity(SearchFactor.AccountName, "Team Foundation Administrators", QueryMembership.Direct);
return gss.IsMember(groupIdentity.Sid, userIdentity.Sid);
}