Domino Code Fragment

Code Name*
NotesACL Class
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.149.214.32
Description*
This example will ask you for the name of a role. Once the role name has been entered, all of the names in the role will be displayed.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
This example will ask you for the name of a role. Once the role name has been entered, all of the names in the role will be displayed. Notice that brackets need to be a part of the role name, and that the role name must be entered exactly, including capitalization and spacing.

Click here to view the example.
  Dim session As New NotesSession 'Declare Variable session as a new Notes session
Dim db As NotesDatabase
'Declare db as a Notes Database
Dim acl As NotesACL
'Declare acl as the Notes Database ACL
Dim aclentry As NotesACLEntry
'Declare aclentry as ACL Entry type
Dim RoleName As String
'Declare RoleName as type String
Dim FoundIt As Variant
'Declare FoundIt as type Variant
Set db = session.CurrentDatabase
'Set db to the currently selected database
Set acl = db.ACL
'Set acl to the ACL of the currently selected database
RoleName = Inputbox$( "Role name? (Don't add brackets to the name!)" )

'Prompt for the Role Name from the user
RoleName = "[" & roleName & "]"
'Add the brackets that indicate a Role in Notes
Forall RNames In acl.Roles
'Run the following code for all Roles in the Role list
'acl.Roles
If ( RNames = RoleName ) Then
'Checks to see if the requested Rolename is the
'currently selected role from acl.Roles
FoundIt= True
'If the role already exists set FoundIt to TRUE
Exit Forall
'And Exit the Forall loop
End If
End Forall
If ( FoundIt = False ) Then
'If the Role Name was not found
Messagebox( Cstr(RoleName) + " cannot be found in the ACL of this database." )

'Display a message to the user
Else
'If the Role Name does exist in acl.Roles
Set aclentry = acl.GetFirstEntry
'Set aclentry to the first name in the ACL
While Not ( aclentry Is Nothing )
'Continue looping until you run out of names in the ACL
If ( aclentry.IsRoleEnabled( RoleName ) = True ) Then

'If that ACL name is in the selected role
Messagebox aclentry.Name
'Display that name to the user
End If
Set aclentry = acl.GetNextEntry( aclentry )
'Move to the next name in the ACL list
Wend
End If