Examples: Save method (NotesACL - LotusScript®)

  1. This script adds a new role to the access control list of the current database, and saves the ACL. If the script did not call Save, the role would not be added.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim acl As NotesACL
    Set db = session.CurrentDatabase
    Set acl = db.ACL
    Call acl.AddRole( "HR Contact" )
    Call acl.Save
  2. This script prompts the user for the name of a person. The script creates a new entry for the person in the ACL of the current database, and gives the entry Author access. The script then asks the user to confirm the ACL change. If the user selects Yes, the change is saved. If the user selects No, the change is not saved.

    In order to use the constants associated with the Messagebox function, this script must include the file LSCONST.LSS.

    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim acl As NotesACL
    Dim entry As NotesACLEntry
    Dim newName As String    
    Dim confirm As Integer
    Set db = session.CurrentDatabase
    Set acl = db.ACL
    newName = Inputbox$ _
    ( "Who do you want to add?", "Name" )    
    Set entry = New NotesACLEntry _
    ( acl, newName, ACLLEVEL_AUTHOR )
    confirm = Messagebox _
    ( "Are you sure?", MB_YESNO, "Confirm" )
    If ( confirm = IDYES ) Then
      Call acl.Save
    End If