Examples: IsRoleEnabled method

This script creates a new document in the workspace. If the current user is a member of the Supervisor role in the database, the approval form is used to create the document; otherwise, the request form is used.

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim acl As NotesACL    
Dim entry As NotesACLEntry
Set db = session.CurrentDatabase
Set acl = db.ACL
Set entry = acl.GetEntry( session.CommonUserName )
If entry Is Nothing Then
  Set entry = acl.GetEntry( session.UserName )
End If
If entry Is Nothing Then
  Messagebox _
  "No entry for " & session.CommonUserName & _
  " or " & session.UserName,, "No entry"
  Exit Sub
End If
If entry.IsRoleEnabled( "[Supervisor]" ) Then
  Set uidoc = workspace.ComposeDocument( "", "approval" )
Else
  Set uidoc = workspace.ComposeDocument( "", "request" )
End If