Examples: UserType property

  1. This code, when added to the Onload event on a form, sets the ACL user type for Mary Ann Admin to Person when a new document is created.
    Sub Onload(Source As Notesuidocument)
      Dim session As new NotesSession
      Dim db As NotesDatabase
      Dim acl As NotesACL
      Dim entry As NotesACLEntry
      Set db = session.CurrentDatabase
      Set acl = db.ACL
    Set entry = acl.GetEntry("Mary Ann Admin/East/ACME")
      If Not (entry Is Nothing) Then
     	  entry.UserType = ACLTYPE_PERSON
    	  Call acl.Save()
      End If
    End Sub
  2. This code, when added to the same form in the Onunload event, displays a message box that states, "Mary Ann Admin has a user type of Person" when the form is closed.
    Sub Onunload(Source As Notesuidocument, Continue As Variant)
      Dim session As new NotesSession
      Dim db As NotesDatabase
      Dim acl As NotesACL
      Dim entry As NotesACLEntry
      Set db = session.CurrentDatabase
      Set acl = db.ACL
    Set entry = acl.GetEntry("Mary Ann Admin/East/ACME")
      If (entry.UserType = ACLTYPE_PERSON) Then
        Messagebox "Mary Ann Admin has a user type of Person" _
        ,,"User type"
      End If
    End Sub