例: QueryAccessPrivileges method

次のエージェントは、現在のデータベースでの現在のユーザーの権限を取得します。

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim msg As String
  Dim title As String
  Dim user As String
  Dim accPriv As Long
  Set db = session.CurrentDatabase
  title = db.Title
  user = session.UserName
  accPriv = db.QueryAccessPrivileges(user)
  REM Check each privilege bit to see if it is on
  If (accPriv And DBACL_CREATE_DOCUMENTS) > 0 Then
    msg = "Create documents"
  End If
  If (accPriv And DBACL_DELETE_DOCUMENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Delete documents"
  End If
  If (accPriv And DBACL_CREATE_PRIV_AGENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Create private agents"
  End If
  If (accPriv And DBACL_CREATE_PRIV_FOLDERS_VIEWS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Create private folders/views"
  End If
  If (accPriv And DBACL_CREATE_SHARED_FOLDERS_VIEWS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Create shared folders/views"
  End If
  If (accPriv And DBACL_CREATE_SCRIPT_AGENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Create LotusScript/Java agents"
  End If
  If (accPriv And DBACL_READ_PUBLIC_DOCUMENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Read public documents"
  End If
  If (accPriv And DBACL_WRITE_PUBLIC_DOCUMENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Write public documents"
  End If
  If (accPriv And DBACL_REPLICATE_COPY_DOCUMENTS) > 0 Then
    msg = msg & Chr(10) & Chr(13) & "Replicate or copy documents"
  End If
  REM Write message
  Messagebox msg,, "Privileges for " & user & " in " & title
End Sub