Subject: Tool or script to mass-edit/repair mailbox ACLs?
As long as your ID has Manager access to the databases (you can use Full Access Administration and “Manage ACLs->Add/Remove” to accomplish that much), you can use this:
Warning: code is off-the-cuff. If you run into problems, please let me know.
Option Public
Option Declare
Dim s As NotesSession
Dim NAB As NotesDatabase
Dim peopleView As NotesView
Dim personDoc As NotesDocument
Dim mailDb As NotesDatabase
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
Dim userName As String
Dim mailServerName As String
Dim mailDbFilepath As String
Dim isUserListed As Boolean
Sub Initialize
Set s = New NotesSession
Set NAB = s.GetDatabase(<server name goes here>,"names.nsf")
Set peopleView = NAB.GetView("($VIMPeople)")
Set personDoc = peopleView.GetFirstDocument
Do Until personDoc Is Nothing
If personDoc.GetItemValue("MailSystem") = "Notes" Then
userName = personDoc.GetItemValue("FullName")(0)
mailServerName = personDoc.GetItemValue("MailServer")(0)
mailDbFilepath = personDoc.GetItemValue("MailFile")(0)
Set mailDb = s.GetDatabase(mailServerName,mailDbFilepath)
If Not (mailDb Is Nothing) Then
isUserListed = False
Set acl = mailDb.ACL
Set aclEntry = acl.GetFirstEntry
Do Until aclEntry Is Nothing
If aclEntry.Name = userName Then
If aclEntry.Level > 0 Then
'User has not been specifically denied access by name
'(may be part of termination process)
'Make access level Editor
aclEntry.Level = 4
End If
isUserListed = True
Exit Do
End If
Loop
If Not isUserListed Then
'User was not listed in mail db ACL
Set aclEntry = acl.CreateACLEntry(userName,4)
'Sets the user to Editor to avoid future ACL problems
aclEntry.IsPerson = True
End If
Call acl.Save
Else
Messagebox("Mail database not found for " & userName & ".",48,"Agent Error")
End If
End If
Set personDoc = peopleView.GetNextDocument(personDoc)
Loop
End Sub
You’ll need the Designer client to create a LotusScript agent. Where you store the agent is pretty much up to you – it doesn’t need to be in any particular database, as long as it is able to connect to all of your mail servers and you are allowed to create and run LotusScript agents in the host database. It can be set to run manually or on schedule with a target of “All documents in database” or “None”.
For , just enter the name of any server that has a complete replica of the Domino Directory for your domain. If you really, really want to give your users Manager access to their mail databases, you can change this line:
Set aclEntry = acl.CreateACLEntry(userName,4)
to read:
Set aclEntry = acl.CreateACLEntry(userName,6)
and kill the If segment that sniffs the aclEntry.Level.