I am trying to use an Agent to modify ACL settings.The Agent runs in the Catalog database from within the views.
A couple of things I notice that I cant figure out:
-
Even though I attempt to read the entire db catalog I only get about 15 databases back from the call (should get a few hundred)
-
I am not able to issue the DOM NotesACL Save command - I get an error that I am " not authorized to perform that operation ". I am a member of the Admin group, do I need to have another permission?
Here is the code:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim DBdir As NotesDbDirectory
Dim acl As NotesACL
Dim aclentry As NotesACLEntry
Dim badaclentry As NotesACLEntry
Dim firstEntry As NotesACLEntry
Dim nextEntry As NotesACLEntry
Dim tempEntry As NotesACLEntry
Set DBDir = session.GetDbDirectory(“”)
Set db = DBdir.GetFirstDatabase(Database)
Dim flag As Boolean
Do Until db Is Nothing
If Instr(1,db.FileName,“CustCSA.nsf”,4) Then
'Open the database
flag = db.Open("","")
If flag Then
'First create new entry for Admins, set UserType and allow deletion of documents
Set acl =db.ACL
Set aclentry = acl.CreateACLEntry("Admins", ACLLEVEL_MANAGER)
aclentry.UserType = ACLTYPE_PERSON_GROUP
aclentry.CanDeleteDocuments = True
Set firstEntry = acl.GetFirstEntry
While Not firstEntry Is Nothing
'change all the old entries except for those that need access
If Instr(1, firstEntry.Name ,"admin" ,1) = 0
And Instr(1,firstEntry.Name,"connector",1) = 0
And Instr(1,firstEntry.Name,"notes",1) = 0
And Instr(1,firstEntry.Name,"servers",1) = 0 Then
Messagebox "No Access " & firstEntry.Name,MB_OK,"No Access"
firstEntry.Level = ACLLEVEL_NOACCESS
Else
If Instr(1,firstEntry.Name,"credit",1) > 0 Then
Messagebox "No Access " & firstEntry.Name,MB_OK,"No Access"
firstEntry.Level = ACLLEVEL_NOACCESS
Else
Messagebox firstEntry.Name & " stays",MB_OK,"Stays"
End If
End If
Set nextEntry = acl.GetNextEntry(firstEntry)
Set firstEntry = nextEntry
Wend
Call acl.Save
End If
End If
Set db = DBDir.GetNextDatabase
Loop
End Sub