The core of our parts website is created by Domino web agents. These agents are written in lotusscript and Several of the items are shown or hidden base on user roles.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Since there wasn't a function capable of checking roles for groups I wrote verifyUserRole. You pass in the Role, Session, and Canonical User name and it returns true or false.
As a test copy this code into an agent and call it via url from your web browser.
Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim acl As NotesACL Dim entry As NotesACLEntry Dim doc As notesdocument Dim nn As notesname Set doc = s.documentcontext Set nn = New notesname(doc.remote_user(0)) role$ = "[com]" roleIsEnabled = verifyUserRole (role$, s, nn.Canonical) If roleIsEnabled Then Print role$ & " is enabled for user " & nn.Abbreviated Else Print role$ & " isn't enabled for user " & nn.Abbreviated End If End Sub Function verifyUserRole (role As String, s As NotesSession, user_Name As String) As Variant Dim acl As NotesACL Dim entry As NotesACLEntry Dim currdb As NotesDatabase Dim GroupsView As NotesView Dim groupdoc As NotesDocument Set currdb = s.CurrentDatabase Dim NAdb As New NotesDatabase(currdb.Server,"names.nsf") Set acl = currdb.ACL Set GroupsView = NAdb.GetView("Groups") roleIsEnabled = False 'Check to see if the user is listed directly in the ACL Set entry = acl.GetEntry( user_Name ) If Not entry Is Nothing Then If entry.Isroleenabled(role$) Then verifyUserRole = True ' print "User role" & role & " is enabled for " & user_Name Exit Function End If Else 'User is not listed get first entry in the ACL to look for groups Set entry = acl.GetFirstEntry While Not entry Is Nothing ' print "entry " & entry.name & " <br>" If entry.Isgroup Then ' print entry.name & " is a group<br>" If entry.IsRoleEnabled(role)Then ' print "The " & role & " role is enabled for " & user_Name & " in group " & entry.name & "<br>" 'Find group in the Address Book Set groupdoc = GroupsView.GetDocumentByKey(entry.name) If Not groupdoc Is Nothing Then 'Roll through members and check for current user Forall names In groupdoc.members If user_Name = names Then ' print "verified <br>" verifyUserRole =True 'role is enabled for user Exit Function Exit Forall End If End Forall End If End If End If 'Get next ACL entry Set entry = acl.GetNextEntry(entry) Wend End If End Function