LS中针对存取控制权限acl的相关操作和判读(二)

来源:互联网 发布:人工智能行业分析报告 编辑:程序博客网 时间:2024/06/07 07:43
 

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

原创粉丝点击