Free Tool: Analyze ACL in Notes Application/Database
Yesterday my network admin asked me if I could write a simple tool that could provide him with with a spreadsheet of what users had access to a certain database, and through what groups and roles. A couple of hours later I had created an agent that analyze the ACL and identify the users who can access it. The result is presented as a CSV file. I am sharing the code below. It is pretty straight forward. As you can see, I am using lists to hold the data for easy export later to CSV. Run the code with the Lotusscript debugger turned on, and put a breakpoint before the CSV export starts, and you can see how the data is stored in the lists. The function ExpandGroups() is called recursively to drill down, if the group contains additional groups. This function also use a lookup into a custom view, (LookupPeople), that we have in our corporate NAB, I am sure you can modify this code with something that works for you. Enjoy! As always, use the code on your own risk, no warranties, etc. %REM Agent Export ACL Info to CSV Created Nov 14, 2011 by Karl-Henry Martinsson/Deep-South Description: Read ACl for specified database and create a CSV file with info about each user's access (roles, groups, delete access, access level). %END REM Option Public Option Declare Dim nab As NotesDatabase Type RowData role As String group As String username As String deletedoc As String level As String levelno As Integer End Type Class GroupData Public roles List As String Public Sub New() End Sub End Class Class PersonData Public accesslevel As Integer Public roles List As String Public deletedoc As boolean Public accessthrough List As String Public Sub New() me.deletedoc = False End Sub Public Sub SetAccessLevel(level As Integer) If me.Accesslevel<level Then me.AccessLevel = level End If End Sub Public Function GetAccessLevelText() Select Case me.AccessLevel Case 0 : GetAccessLevelText = "No Access" Case 1 : GetAccessLevelText = "Depositor" Case 2 : GetAccessLevelText = "Reader" Case 3 : GetAccessLevelText = "Author" Case 4 : GetAccessLevelText = "Editor" Case 5 : GetAccessLevelText = "Designer" Case 6 : GetAccessLevelText = "Manager" End Select End Function End Class Class RoleData Public groups List As String Public Sub New() End Sub End Class Sub Initialize Dim ws As New NotesUIWorkspace Dim session As New NotesSession Dim db As NotesDatabase Dim pview As NotesView Dim pdoc As NotesDocument Dim acl As NotesACL Dim entry As NotesACLEntry Dim person List As PersonData Dim group List As GroupData Dim role List As RoleData Dim users As Variant Dim row List As RowData Dim cnt As Long Dim groupname As String Dim filename As String Dim rowstr As String Dim dbname As String Dim servername As String servername = InputBox$("Enter server for database:","Select Server") If servername = "" Then Exit Sub End If dbname = InputBox$("Enter full path of database:","Select Database") If dbname = "" Then Exit Sub End If set nab = New NotesDatabase(servername,"names.nsf") Set db…
