Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Controlling User permissions from an Excel file

4 REPLIES 4
Reply
Message 1 of 5
AlexFielder
933 Views, 4 Replies

Controlling User permissions from an Excel file

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.

4 REPLIES 4
Message 2 of 5
Redmond.D
in reply to: AlexFielder

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.

Message 3 of 5
AlexFielder
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.

Message 4 of 5
AlexFielder
in reply to: AlexFielder

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.

 

Message 5 of 5
AlexFielder
in reply to: AlexFielder

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

 Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report