IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Lotus Sandbox

Lotus Sandbox

developerWorks
User Review of ACL Scanner
Submitted by Pascal Gauthier Collabora on 04/10/2001.
Rating: 4 stars
I found and fixed two small problems:
1) On some db, I can get a NotesDatabase object but the ACL returns empty and crashes the agent. I think this is when my access is "No Access" with "Read public documents". I fixed it in the code I pasted at the bottom of this comment
2)The option to search for a specific entry returns only the entries with the exact case of the spelling of the entry. I also fixed it in the code below. My modifications are titled "PG20010410 Here is a new fix".

Except for these easy to fix problems, your application helped me a lot! Thanks

Sub Click(Source As Button)
On Error Goto ErrHandler
'*************
'* Variables
'*************
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim ctxt As NotesDocument
Dim dbDir As NotesDbDirectory
Dim db As NotesDatabase
Dim item As NotesItem
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
Dim Entry As String, Server As String, DBTypes As String
Dim Search As Variant, Recurse As Variant, CannotOpen As Variant
Dim ACLLevels As New array
Dim x As Integer
Dim searchName As NotesName
Dim tempName As NotesName
Dim searchItem As NotesItem
'******************
'* Instantiations
'******************
Set uidoc = ws.CurrentDocument
Set ctxt = uidoc.Document
Set checkedNames = New Array
Set checkedGroups = New Array
Set ACLLog = New ACLLog( "ACL Report for " & s.CommonUserName & " created at " & Cstr( Now ), ctxt.Unique(0) )
Call ACLLog.LogAction( "Starting to generate ACL Report" )
'*******************************************************************************************************************************************************
'* Variables from report form, this will speed the processing up, as we won't have to make calls to ctxt for every database we scan
'*******************************************************************************************************************************************************
Server = ctxt.Server(0)
If ctxt.Search(0) = "1" Then
Search = True
Else
Search = False
End If
If ctxt.Recurse(0) = "1" Then
Recurse = True
Else
Recurse = False
End If
Entry = ctxt.Entry(0)
DBTypes = ctxt.DBTypes(0)
Set item = ctxt.GetFirstItem( "ACLLevels" )
Call ACLLevels.Initialize( item.values )
'************************************************
'* Get handle of DBDir and first database
'************************************************
Set dbDir = New NotesDbDirectory( Server )
Select Case DBTypes
Case "NSF"
'* User wants NSFs
Set db = dbDir.GetFirstDatabase( DATABASE )
Case "NTF"
'* User wants NTFs
Set db = dbDir.GetFirstDatabase( TEMPLATE )
Case "ALL"
'* User selected template candidate
Set db = dbDir.GetFirstDatabase( TEMPLATE_CANDIDATE )
Case "REPLICA"
'* User selected replica candidate
Set db = dbDir.GetFirstDatabase( REPLICA_CANDIDATE )
End Select
'*******************************************
'* Start looping through all databases
'*******************************************
Do While Not db Is Nothing
'* Open database if it isn't open
If Not db.IsOpen Then
Call db.Open( db.Server , db.filepath ) '* If db can't be opened, an error will be thrown, see errHandler
If CannotOpen Then
'* Can't open db, write out to log and continue
Call ACLLog.LogAction( |Cannot open database "| & db.Title & |" from location "| & db.filepath & |". Continuing to next database.| )
End If
End If
If CannotOpen Then
'* reset CannotOpen flag
CannotOpen = False
Else
Set acl = db.ACL
' PG20010410 Here is a new fix
If acl Is Nothing Then
Call ACLLog.LogAction( |Cannot get the ACL Handle "| & db.Title & |" from location "| & db.filepath & |". Continuing to next database.| )
Else

Set aclEntry = acl.GetFirstEntry
'********************************************
'* Start looping through all ACL Entries
'********************************************
While Not aclEntry Is Nothing
If Search Then
Set searchItem = ctxt.GetFirstItem( "Entry" )
Forall value In searchItem.values
Set searchName = New NotesName( value )
If Recurse Then
Call recurseEntry( aclEntry , server )
For x = checkedNames.LBounds To checkedNames.UBounds
Set tempName = New NotesName( checkedNames.GetNthValue( x ) )
' PG20010410 Here is a new fix
If Lcase(searchName.Abbreviated) = Lcase(tempName.Abbreviated) Then
'* This name matches, write out to log
Call ACLLog.LogLevel( ACLEntry, db, searchName.Abbreviated )
End If
Next
'* Clear out values for next group
Delete checkedNames
Delete checkedGroups
Set checkedNames = New Array
Set checkedGroups = New Array
Else
Set tempName = New NotesName( aclEntry.Name )
If searchName.Abbreviated = tempName.Abbreviated Then
'* This name matches, write out to log
Call ACLLog.LogLevel( ACLEntry, db, searchName.Abbreviated )
End If
End If
End Forall
Else
If ACLLevels.IsMember( Cstr( aclEntry.Level ) ) Then
'* an acl entry we want to report on, write out to log file
'* See if we want to recurse groups
If Recurse Then
'* we need to see if this entry is a group, and if it is, we need to grab its members recursively
Call recurseEntry( aclEntry , server )
For x = checkedNames.LBounds To checkedNames.UBounds
Call ACLLog.LogLevel( ACLEntry, db, checkedNames.GetNthValue( x ) )
Next
'* Clear out values for next group
Delete checkedNames
Delete checkedGroups
Set checkedNames = New Array
Set checkedGroups = New Array
Else
Call ACLLog.LogLevel( ACLEntry , db , ACLEntry.Name )
End If
End If
End If
Set aclEntry = acl.GetNextEntry( aclEntry )
Wend
End If
End If
Set db = dbDir.GetNextDatabase
Loop

Call ACLLog.LogAction( "Finished generating ACL Report successfully" )
Msgbox "The ACL Report has finished successfully. Please check the log."
Exit Sub

ErrHandler:
'******************
'* Handle errors
'******************
'* Skip database if we can't open it
If Err = 4060 Then
CannotOpen = True
Resume Next
End If
'********************************************************************************************************
'* Write error to agentLog and throw up a message box indicating we ended with an error
'********************************************************************************************************
Call ACLLog.LogError( Err , Error, Erl, "Click" )
Msgbox "The ACL Report ended with an error. Please see log file for more details." & db.Title
Exit Sub
End Sub

Go back

Lotus Software

Document options
Print view

  Sandbox views
By Application Name
By Category
By Product
By Audience
By Date
By Submitter
Conferences

  Resources
developerWorks: Lotus Downloads
alphaWorks Downloads
    About IBM Privacy Contact