Sub Initialize()
On Error GoTo a
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.Currentdatabase
'从数据库ACL中获取具备[manager]角色的用户(个人)
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
Set acl = db.acl
Set aclEntry = acl.GetFirstEntry
While Not aclEntry Is Nothing
'判断Entry中用户类型为“个人”的则:
If aclEntry.IsPerson Then
'循环找到的Entry中的所以角色
ForAll strRoles In aclEntry.Roles
'判断找到的角色是否为“管理员”
If strRoles="[管理员]" Then
Dim strTmp As Variant
strTmp = aclEntry.Name
Exit ForAll
End If
End ForAll
End If
Set aclEntry = acl.getNextEntry(aclEntry)
Wend
'Call aclEntry.enableRole( "[manager]" ) '使当前角色生效
'Call acl.Save() '保存当前的acl
Exit Sub
a:
MsgBox "错误在代理agent_acl2的第" & Erl & "行,描述:---" & Error
End Sub