Examples: QueryAccess method

  1. This script gets the access level for Susanna Coyle in the database CHECK.NSF.
    Dim db As NotesDatabase
    Dim level As Integer
    Set db = New NotesDatabase( "Belem", "check.nsf" )
    level = db.QueryAccess( "Susanna Coyle" )
    • If Susanna Coyle has Author access to the database, level contains ACLLEVEL_AUTHOR.
    • If Susanna Coyle is a member of a group that has Designer access to the database, and Susanna is not otherwise listed in the ACL, level contains ACLLEVEL_DESIGNER.
    • If Susanna Coyle is a member of one group that has Editor access to the database and another group that has Designer access to the database, and Susanna is not otherwise listed in the ACL, level contains ACLLEVEL_DESIGNER.
    • If Susanna Coyle is not explicitly listed in the ACL and is not a member of any groups listed in the ACL, but the Default access of the database is Reader, level contains ACLLEVEL_READER.
  2. This form action script checks the current user's access level to a database before looking up a series of values from that database. If the user does not have Reader access or better, a message is displayed and the script exits. If the user has Reader access or better, the target database is opened and column values from its Product view are appended to the Body field of the currently open document.
    Sub Click(Source As Button)
      Dim session As New NotesSession 
      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim db As New NotesDatabase( "Cambridge", "sites.nsf" )
      Dim view As NotesView
      Dim doc As NotesDocument
      If ( db.QueryAccess( session.CommonUserName ) < _
      ACLLEVEL_READER ) Then
        Messagebox( "The information from " + db.Title +  _
        " is unavailable." )
      Else
        Set uidoc = workspace.CurrentDocument
        Set view = db.GetView( "Locations" )
        Set doc = view.GetFirstDocument
        While Not ( doc Is Nothing )
          Call uidoc.FieldAppendText( "Body",  _
                                      doc.ColumnValues( 0 ) )
          Set doc = view.GetNextDocument( doc )
        Wend
      End If
    End Sub