Quantcast
Viewing all articles
Browse latest Browse all 14708

Re: QC Group Administration using OTA

Chris,

 

Your problem seems to be a common one  - ie how to update group permissions on many projects.  It is an interesting challenge, and it can be quite useful, so I thought I would give it a go.

 

I came up with an Excel spreadsheet with some OTA macro code that will read through a list of projects, groups and actions, and "check the box" for each permission for that group.  The first thing you will need are the names of the actions (ie permissions) that you want to modify.  This can be found with this code:

 

Sub Get_Actions()
    Dim td As New TDConnection
    Dim cust As Customization
    Dim allActions As CustomizationActions
    Dim act As CustomizationAction
    Dim rng As Range
    Set rng = ActiveWorkbook.Worksheets("Actions").Range("A2:A2")
    td.InitConnectionEx "http://xxxxxxx/qcbin"
    td.ConnectProjectEx "DOMAIN", "Project", "userid", "password"

    Set cust = td.Customization
    cust.Load
    
    Set allActions = cust.Actions

    i = 0
    For Each act In allActions.Actions
        rng.Offset(i, 0) = act.Name
        i = i + 1
    Next
    
    td.Logout
    td.DisconnectProject
    td.ReleaseConnection
 
End Sub

 This will write out a list of all possible actions for the project to a worksheet called 'Actions'.  You have to provide your own server, domain,  project, user and password.  From that list, we see that the actions you are interested in are 'ac_modify_library', 'ac_import_library' and 'ac_sync_library'. 

 

Then you can create a new worksheet and list the domain, project, action and group that you want to modify.  Something like this:

 

Domain   Project   Action                   Group

DOMAIN Project1 ac_modify_library QATester

DOMAIN Project2 ac_import_library  QATester

DOMAIN Project3 ac_sync_library     QATester

 

Now, the following code will read through the list, log into each project (you need one user who has access to all projects), and enable the action for the given group.

 

Sub Modify_Projects()
    Dim ret
    Dim rng As Range
    Set rng = ActiveWorkbook.Worksheets("Projects").Range("F2:F4")
    For Each r In rng
        ret = Modify_Action(r.Offset(0, 2), r.Offset(0, 3), r.Offset(0, 0), r.Offset(0, 1), "user", "password")
    Next
End Sub

Function Modify_Action(s_act As String, s_grp As String, dom As String, proj As String, usr As String, pwd As String)
    Dim td As New TDConnection
    Dim cust As Customization
    Dim allActions As CustomizationActions
    Dim act As CustomizationAction
    
    Modify_Action = False
    
    td.InitConnectionEx "http://xxxxxx/qcbin"
    td.ConnectProjectEx dom, proj, usr, pwd

    Set cust = td.Customization
    cust.Load
    
    Set allActions = cust.Actions

    Set act = allActions.Action(s_act)
    act.AddGroup s_grp
    
    cust.Commit

    Modify_Action = act.IsGroupPermited(s_grp)
    
    td.Logout
    td.DisconnectProject
    td.ReleaseConnection
 
End Function

 

Interestingly enough, this method allows you to enable permissions for the built-in groups that are otherwise not updateable from the GUI.  I tested it and it works like a charm.

 

Good luck,

William


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>