Manage Learn to apply best practices and optimize your operations.

Retrieve A Database's Acl History

This LotusScript function takes a NotesDatabase object as an argument and
returns a list (Variant) of all entries in the db's ACL change history log (up
to the Notes-imposed maximum of 20). If no history is found, False is returned

This is the same list you get when performing a "File - Database - Access
Control - Log" from the Notes R5 Client. As this makes one call to the Win32
API, it will only work on the Win32 platform.

Here is a sample button script that displays the ACL change history for a
database in a Messagebox:

Sub Click(Source As Button)
Dim session As New NotesSession
Dim vHistory As Variant
Dim msg$


If Not vHistory Then
Msgbox "There is no ACL change history for this database.", 48, "ACL History
Forall i In vHistory
msg$=msg$ & i & Chr(13) & Chr(10)
End Forall

Msgbox msg$, 0, "ACL History for " & session.CurrentDatabase.Title
End If
End Sub
' Notes API declares
Declare Sub OSPathNetConstruct Lib "nnotes" (Byval portName$, Byval
ServerName$, Byval FileName$, Byval retPathName$)
Declare Function NSFDbReadACL% Lib "nnotes" (Byval hDB&, hACL%)
Declare Function ACLGetHistory% Lib "nnotes" (Byval hACL%, hHistory%,
Declare Function NSFDbOpen% Lib "nnotes" (Byval PathName$, hDB&)
Declare Function NSFDbClose% Lib "nnotes" (Byval hDB&)
Declare Function OSMemFree% Lib "nnotes" (Byval Handle%)
Declare Function OSLockObject& Lib "nnotes" (Byval nHandle&)
Declare Function OSUnlockObject% Lib "nnotes" (Byval nHandle&)

' Win32 API
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Byval pDest$,
Byval pSource&, Byval dwLength&)

Function GetACLHistory(db As NotesDatabase) As Variant
Dim hDb&, hLock&
Dim hHistory%, hACL%, nCount%, nLoop%
Dim Path$, History$, Hold$
Dim theList() As String

History$=String$(1, 0)

' create path to db and open it
OSPathNetConstruct "", db.Server, db.FilePath, Path$
NSFDbOpen Path$, hDb&

' read the ACL into memory, and retrieve the history
NSFDbReadACL hDb&, hACL%
ACLGetHistory hACL%, hHistory%, nCount%

' process only if there are entries in the ACL history
If nCount% > 0 Then

' lock down the handle to the history

Do While nLoop% < nCount%
' extract history one character at a time using Win32 API call
CopyMemory History$, hLock&, 1

If History$ = Chr$(0) Then
' if we encounter a null character, there will be one following it
(e.g., LastEntry\0\0PrevEntry\0\0),
' so advance pointer two steps, copy current entry to array, and begin
work on next entry
nLoop%=nLoop% + 1
hLock& = hLock& + 2
Redim Preserve theList(nLoop%)
' advanced pointer one char at a time, and build a history entry
hLock& = hLock& + 1
Hold$=Hold$ + History$
End If

' release the lock on--and free--the history handle
OSMemFree hHistory%

' return the history as a Variant
End If

' free handles to ACL and db
OSMemFree hACL%
NSFDbClose hDb&
End Function

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...