26/12/2010 19:58 El Bruno

[TFS2010] HowTo: Consultar permisos de seguridad utilizando TFSWebServices

image47dd1de4

Buenas,

hoy toca darle un vistazo a una de las operaciones del WebService que gestiona la Seguridad en Team Foundation Server 2010, usualmente ubicado en

http://server:8080/tfs/TeamFoundation/Administration/v3.0/SecurityService.asmx

La operación [QuerySecurityNamespaces] nos permite enumerar los diferentes permisos que existen a nivel servidor para TFS2010. El siguiente código muestra un ejemplo, en el que se enumeran los servicios y las acciones disponibles para cada uno:

   1: static void Main(string[] args)
   2: {
   3:     var securityWebServiceSoapClient = new SecurityWebServiceSoapClient();
   4:     var request = new QuerySecurityNamespacesRequest();
   5:     var response = securityWebServiceSoapClient.QuerySecurityNamespaces(request);
   6:                 Console.WriteLine("Security Namespaces"); 
   7:     Console.WriteLine();
   8:     foreach (var securityNamespaceDescription in response.QuerySecurityNamespacesResult)
   9:     {
  10:         Console.WriteLine(" Database Category: {0}", securityNamespaceDescription.databaseCategory);
  11:         Console.WriteLine(" Display Name: {0}", securityNamespaceDescription.displayName);
  12:         Console.WriteLine(" ReadPermission: {0}", securityNamespaceDescription.readPermission);
  13:         Console.WriteLine(" WritePermission: {0}", securityNamespaceDescription.writePermission);
  14:         Console.WriteLine(" Actions");
  15:         foreach (var action in securityNamespaceDescription.Actions)
  16:         {
  17:             Console.WriteLine("   DisplayName: " + action.displayName);
  18:             Console.WriteLine("   Name: " + action.name);
  19:             Console.WriteLine("   Bit: " + action.bit);
  20:         }
  21:         Console.WriteLine(); 
  22:     }
  23:     Console.ReadLine();
  24: }

 

El resultado de la ejecución es similar al siguiente:

   1: Security Namespaces
   2:  
   3:  Database Category: Framework
   4:  Display Name: Registry
   5:  ReadPermission: 1
   6:  WritePermission: 2
   7:  Actions
   8:    DisplayName: Read registry entries
   9:    Name: Read
  10:    Bit: 1
  11:    DisplayName: Write registry entries
  12:    Name: Write
  13:    Bit: 2
  14:  
  15:  Database Category: Framework
  16:  Display Name: WebAccess
  17:  ReadPermission: 0
  18:  WritePermission: 3
  19:  Actions
  20:    DisplayName: Use full Web Access features
  21:    Name: FullAccess
  22:    Bit: 1
  23:    DisplayName: Modify full Web Access users
  24:    Name: Modify
  25:    Bit: 2
  26:  
  27:  Database Category: Framework
  28:  Display Name: Identity
  29:  ReadPermission: 1
  30:  WritePermission: 2
  31:  Actions
  32:    DisplayName: View identity information for this scope
  33:    Name: GenericRead
  34:    Bit: 1
  35:    DisplayName: Edit identity information for this scope
  36:    Name: GenericWrite
  37:    Bit: 2
  38:  
  39:  Database Category: Framework
  40:  Display Name: Job
  41:  ReadPermission: 1
  42:  WritePermission: 6
  43:  Actions
  44:    DisplayName: View background job information
  45:    Name: Read
  46:    Bit: 1
  47:    DisplayName: Queue background jobs
  48:    Name: Queue
  49:    Bit: 2
  50:    DisplayName: Manage background jobs
  51:    Name: Update
  52:    Bit: 4
  53:  
  54:  Database Category: Framework
  55:  Display Name: Server
  56:  ReadPermission: 1
  57:  WritePermission: 2
  58:  Actions
  59:    DisplayName: View instance-level information
  60:    Name: GenericRead
  61:    Bit: 1
  62:    DisplayName: Edit instance-level information
  63:    Name: GenericWrite
  64:    Bit: 2
  65:    DisplayName: Make requests on behalf of others
  66:    Name: Impersonate
  67:    Bit: 4
  68:    DisplayName: Trigger events
  69:    Name: TriggerEvent
  70:    Bit: 16
  71:  
  72:  Database Category: Framework
  73:  Display Name: CollectionManagement
  74:  ReadPermission: 0
  75:  WritePermission: 3
  76:  Actions
  77:    DisplayName: Create team project collection
  78:    Name: CreateCollection
  79:    Bit: 1
  80:    DisplayName: Delete team project collection
  81:    Name: DeleteCollection
  82:    Bit: 2
  83:  
  84:  Database Category: Framework
  85:  Display Name: Warehouse
  86:  ReadPermission: 0
  87:  WritePermission: 1
  88:  Actions
  89:    DisplayName: Administer Warehouse
  90:    Name: Administer
  91:    Bit: 1
  92:  
  93:  Database Category: Framework
  94:  Display Name: Catalog
  95:  ReadPermission: 1
  96:  WritePermission: 4
  97:  Actions
  98:    DisplayName: View catalog information for this node
  99:    Name: Read
 100:    Bit: 1
 101:    DisplayName: Create children catalog nodes
 102:    Name: Create
 103:    Bit: 2
 104:    DisplayName: Modify catalog node properties
 105:    Name: Modify
 106:    Bit: 4
 107:    DisplayName: Delete this catalog node and its children
 108:    Name: Delete
 109:    Bit: 8
 110:  
 111:  Database Category: Framework
 112:  Display Name: EventSubscription
 113:  ReadPermission: 1
 114:  WritePermission: 2
 115:  Actions
 116:    DisplayName: View
 117:    Name: GenericRead
 118:    Bit: 1
 119:    DisplayName: Edit
 120:    Name: GenericWrite
 121:    Bit: 2
 122:    DisplayName: Unsubscribe
 123:    Name: Unsubscribe
 124:    Bit: 4
 125:    DisplayName: Create a SOAP subscription
 126:    Name: CreateSoapSubscription
 127:    Bit: 8
 128:  
 129:  Database Category: Framework
 130:  Display Name: Lab
 131:  ReadPermission: 1
 132:  WritePermission: 1
 133:  Actions
 134:    DisplayName: View/Edit instance-level Lab information
 135:    Name: ReadWrite
 136:    Bit: 1
 137:  

 

Y finalmente el código de ejemplo, lo pueden descargar desde http://cid-bef06dffdb192125.office.live.com/self.aspx/Code%20Samples/2010%2012%2027%20TFS2010.03Security.zip

 

Saludos @ Home

El Bruno

   

Archivado en: ,,,
Comparte este post: