• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Vault Customization

    Reply
    Mentor
    Posts: 238
    Registered: ‎07-05-2005

    Controlling User permissions from an Excel file

    422 Views, 4 Replies
    10-25-2011 11:17 AM

    Hi folks,

     

    I'm fairly new at customizing Vault, and we've barely begun to scratch the surface of what it can do, let alone how to administer it correctly.

     

    I got my boss up and running with the Vault earlier today and it got me thinking about the easiest/fastest way for an administrator to see exactly what each user can see/do within the Vault; I realise this data is stored in the "Global Settings" option of the Tools menu, but it would seem logical (to me anyway) to keep track of this information using a spreadsheet?

     

    Why not have the spreadsheet/lightswitch application able to perform the administration too? (Naturally, this would all be done using the SDK; I wouldn't dream of editing the Database tables directly!)

     

    Here's how I envisage the spreadsheet working:

     

    It would contain 3 tabs: "Users", "Groups" and "Roles and Permissions" (mirroring the Global settings option from the tools menu)

     

    The users tab would have a username column, a groups column, then columns for each of the project folders that might need their own permissions. It would also have a "Get permissions" and a "Set permissions" button.

     

    The groups tab would have a groupname column, a members column/field (it's at this point I got to thinking that a Lightswitch application might be better than Excel?) and a "Roles and Permissions" Column.

     

    The Roles and Permissions Tab would simply list each role and the permissions it has.

     

    That's it.

     

    Let me know if you I'm wasting my time.

     

    Thanks,

     

    Alex.

    Please use plain text.
    Employee
    Posts: 652
    Registered: ‎12-12-2006

    Re: Controlling User permissions from an Excel file

    10-26-2011 06:36 AM in reply to: AlexF1980

    There is an app called Effective Folder Permissions, which provides some nice features for managing folder security. 

     

    I don't think it fits your current requirements, but it is worth taking a look at since the functionality is related.  The tool is open source, so adding to it might be better than creating a new app.

     



    Doug Redmond
    Software Engineer
    Autodesk, Inc.
    http://justonesandzeros.typepad.com/

    Please use plain text.
    Mentor
    Posts: 238
    Registered: ‎07-05-2005

    Re: Controlling User permissions from an Excel file

    10-26-2011 06:55 AM in reply to: Redmond.D

    I had forgotten I had that extension installed; (It's been a whilst since I looked seriously at our Vault configuration ;-) 

     

    That said, the EFP tool doesn't allow you to capture details of who can do/see what without taking screenshots.

     

    It might provide a useful starting point for what I aim to achieve though. (in that I can take a look at the source code behind it)

     

    Thanks for the tip.

    Please use plain text.
    Mentor
    Posts: 238
    Registered: ‎07-05-2005

    Re: Controlling User permissions from an Excel file

    10-28-2011 08:41 AM in reply to: AlexF1980

    I've gotten a little something cobbled together (see below); loosely based on some work I had previously done for an Inventor addin.

     

    I can get a list of the project folders and populate them into the Excel document I have created using Visual Studio 2010 Professional.

     

    I am struggling with the GetAllUsers command however; are there any restrictions on what roles can call it? I am logging in to the vault from Excel using the WinAuth WebService running on the Vault server - I am an Administrator in the Vault settings but the GetAllUsers() command simply exits with no error messages whatsoever..

     

    Thoughts?

     

    Thanks,

     

    Alex.

     

    PS. Here's the code I've got so far:

     

    Imports Autodesk.Connectivity.WebServices
    
    Public Class ThisWorkbook
    #Region "Vault Web Services"
        ''' <summary>
        ''' creates an instance of the WinAuthService.
        ''' </summary>
        ''' <remarks></remarks>
        Public Shared winAuthSvc As WinAuthService
    
        ''' <summary>
        ''' creates an instance of the DocumentService.
        ''' </summary>
        ''' <remarks></remarks>
        Public Shared docSvc As DocumentService
    
        ''' <summary>
        ''' creates an instance of the SecurityService.
        ''' </summary>
        ''' <remarks></remarks>
        Public Shared SecSvc As SecurityService
    
        ''' <summary>
        ''' creates an instance of the AdminService.
        ''' </summary>
        ''' <remarks></remarks>
        Public Shared AdminSrv As AdminSvc._AdminService
    
    #End Region
    #Region "Local Variables"
        Public Shared folderList As List(Of Folder)
    #End Region
    #Region "ThisWorkbook Startup and Shutdown"
        Private Sub ThisWorkbook_Startup() Handles Me.Startup
    
        End Sub
    
        Private Sub ThisWorkbook_Shutdown() Handles Me.Shutdown
            SecSvc.SignOut()
            SecSvc = Nothing
            docSvc = Nothing
            winAuthSvc = Nothing
        End Sub
    #End Region
    #Region "Menu bar stuff"
        Private MainMenuBar As Office.CommandBar
        Private MenuBarItem As Office.CommandBarControl
        Private WithEvents MenuItem As Office.CommandBarButton
    #End Region
        Private Shared Sub CheckCurrentUserLoggedIn()
            'Vault login, Doc Service & Security Service creation
            winAuthSvc = New WinAuthService()
            winAuthSvc.Url = "http://bas069/AutodeskDM/Services/WinAuth/WinAuthService.asmx"
            winAuthSvc.UseDefaultCredentials = True
            winAuthSvc.SecurityHeaderValue = winAuthSvc.SecurityHeader()
            winAuthSvc.SignIn("Vault")
    
            'this service is what we'll use to find our file(s)
            docSvc = New DocumentService()
            docSvc.Url = "http://bas069/AutodeskDM/Services/DocumentService.asmx"
            docSvc.SecurityHeaderValue = New DocumentSvc.SecurityHeader()
            docSvc.SecurityHeaderValue.Ticket = winAuthSvc.SecurityHeaderValue.Ticket
            docSvc.SecurityHeaderValue.UserId = winAuthSvc.SecurityHeaderValue.UserId
    
            'we've got to create a SecurityService so we have something to sign out of later on.
            SecSvc = New SecurityService()
            SecSvc.Url = "http://bas069/AutodeskDM/Services/SecurityService.asmx"
            SecSvc.SecurityHeaderValue = New SecuritySvc.SecurityHeader()
            SecSvc.SecurityHeaderValue.Ticket = docSvc.SecurityHeaderValue.Ticket
            SecSvc.SecurityHeaderValue.UserId = docSvc.SecurityHeaderValue.UserId
    
            'this is the service we need to find our users/groups/permissions etc.
            AdminSrv = New AdminService()
            'AdminSvc.Url = "http://bas069/AutodeskDM/Services/DocumentService.asmx"
            AdminSrv.SecurityHeaderValue = New AdminSvc.SecurityHeader
            AdminSrv.SecurityHeaderValue.UserId = SecSvc.SecurityHeaderValue.UserId
            AdminSrv.SecurityHeaderValue.Ticket = SecSvc.SecurityHeaderValue.Ticket
    
        End Sub
    
        Private Shared Sub PrintFilesInFolder(ByVal parentFolder As Folder, ByVal docSvc As DocumentService)
            Dim files As File() = docSvc.GetLatestFilesByFolderId(parentFolder.Id, False)
            If (Not files Is Nothing AndAlso files.Length > 0) Then
                For Each file As File In files
                    Dim tmpfolder As New Folder
                    tmpfolder.FullName = parentFolder.FullName
                    If Not tmpfolder.FullName.Contains("Content Center Files") Then
                        'tmpfolder.FullName = parentFolder.FullName + "/" + file.Name
                        Dim tmpstr As String() = tmpfolder.FullName.Split(New Char() {"/"})
                        If Not tmpstr.Length > 3 Then
                            folderList.Add(tmpfolder)
                        End If
                    End If
                Next file
            End If
    
            Dim folders As Folder() = docSvc.GetFoldersByParentId(parentFolder.Id, False)
            If (Not folders Is Nothing AndAlso folders.Length > 0) Then
                For Each folder As Folder In folders
                    PrintFilesInFolder(folder, docSvc)
                Next folder
            End If
        End Sub
    
        Public Shared Sub GetProjectRootFolders()
            CheckCurrentUserLoggedIn()
            'need to clear some of the cells on the active worksheet - namely row 2 to the last.
            folderList = New List(Of Folder)
            Dim rootFolder As Folder = docSvc.GetFolderRoot()
            PrintFilesInFolder(rootFolder, docSvc)
            For i As Integer = 1 To folderList.Count
                Dim range1 As Excel.Range = Globals.Sheet1.Range("c" & i + 1)
                range1.Value = folderList.Item(i).FullName
            Next i
        End Sub
    
        Public Shared Sub GetUsers()
            CheckCurrentUserLoggedIn()
            Dim users As User() = AdminSrv.GetAllUsers()
            'set to 2 so we start to populate at cell A2
            Dim i As Integer = 2
            For Each User As User In users
                Dim range1 As Excel.Range = Globals.Sheet1.Range("a" & i)
                i = i + 1
                range1.Value = User.FirstName & " " & User.LastName
            Next
        End Sub
    End Class

     PPS. GetUsers and GetProjectRootFolders are called from the custom ribbon buttons I created for the excel file.

     

    Please use plain text.
    Mentor
    Posts: 238
    Registered: ‎07-05-2005

    Re: Controlling User permissions from an Excel file

    10-31-2011 05:08 AM in reply to: AlexF1980

    I found the problem with my code; namely this section:

     

    'this is the service we need to find our users/groups/permissions etc.
            AdminSrv = New AdminService()
            'AdminSvc.Url = "http://bas069/AutodeskDM/Services/DocumentService.asmx"
            AdminSrv.SecurityHeaderValue = New AdminSvc.SecurityHeader
            AdminSrv.SecurityHeaderValue.UserId = SecSvc.SecurityHeaderValue.UserId
            AdminSrv.SecurityHeaderValue.Ticket = SecSvc.SecurityHeaderValue.Ticket

     was pointing to the wrong service on the Vault Server. It should have been thus (bold):

     

    'this is the service we need to find our users/groups/permissions etc.
            AdminSrv = New AdminService()
            'AdminSvc.Url = "http://bas069/AutodeskDM/Services/AdminService.asmx"
            AdminSrv.SecurityHeaderValue = New AdminSvc.SecurityHeader
            AdminSrv.SecurityHeaderValue.UserId = SecSvc.SecurityHeaderValue.UserId
            AdminSrv.SecurityHeaderValue.Ticket = SecSvc.SecurityHeaderValue.Ticket

     :smileyhappy:

    Please use plain text.