Some of our Developers often forget to put the Administrators group in the ACL. We found a way to automate adding the Administrators group to the ACL's of ALL database's so that we don't have to worry about it. The trick with this script is that it has to be signed/saved by the id of the server that code runs on. To do this:
-Get a copy of the server id.
-Create a local replica of the database where this will be stored.
-Open up the designer and switch to the server id
-Create a new agent that runs on an schedule (we do it every 8 hrs).
-Copy the code into the "initialize" section.
-Save the agent. (this HAS to be done with the server id)
-Switch back to your id
-replicate the database back to the server.
Now on the next scheduled run, the server will go through and add the "Administrators" group to all ACL's. However if the server or LocalDomainServers group doesn't have Manager access to the database then this will not work.
Code
On Error Goto oops
Dim sess As New NotesSession
Dim db As notesdatabase
Dim dbdir As New notesdbdirectory("")
Set db = dbdir.getfirstdatabase _(TEMPLATE_CANDIDATE)
Do While True
If db Is Nothing Then
Exit Sub
Else
Call db.open("","")
End If
' UNcomment the commented lines to_ ignore mail files
' If Not (Instr _(1,db.filepath,"mail",5) > 0) Then
If db.QueryAccess("Administrators")< _ ACLLEVEL_MANAGER Then
Call db.GrantAccess("Administrators", ACLLEVEL_MANAGER)
Print "Granted Administrators Access_ to: " & db.title
End If
' End If
Set db = dbdir.getnextdatabase
Loop
Exit Sub
oops:
Print "error occurred: " & Error$
Resume Next