Restrict Field Edit Access Based On Roles

Many companies list groups in their ACLs instead of individuals making it
difficult to evaluate user roles. This code is triggered from the Entering
event on a field allowing you to Evaluate groups to see if a role is enabled
and therefore if that individual is authorized to edit a field.

This code is placed in the Entering event.

Note! You may want to Enforce a Consistent ACL Across All Replicas as an added
security feature.
Sub Entering(Source As Field)

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument

Set uidoc = workspace.CurrentDocument
'Checks to see if you are a member of a group assigned the role

Roles = Evaluate(|@isMember("[RoleName]";@UserRoles)|)

If Roles(0) = 1 Then
'if yes, the code does nothing
Exit Sub
Else
'if no, you are kicked to the top of the document
Msgbox "You are not authorized to enter information in that field" ,
16 , "Warning"
Call uidoc.GotoTop
End If

End Sub

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.