elements within a Notes db (no matter which way you know how to do it).
This short script will prevent access to contents of views which you still
want to keep hidden if a user has come in the backdoor so-to-speak.
Access, or the denial thereof, is based on user Role assignment. The user
can still see the hidden views, but the moment they click on one to view
its contents, they will either be allowed access, or receive a message that
tells them access is denied (and, of course, access is then denied).
This example is written as a function in a Script Library, and is being
called from the Queryopen event of the views I am protecting. It can be
easily changed to go directly into the Queryopen should you choose to place
it there.
(this is my own variation of the tip submitted by, Tim Parsons: Prevent
Users from opening a view)
Function fnLockView (Source As NotesUIView, Continue As Variant)
Dim HasRole As Variant
HasRole = Evaluate( |@IsMember("[rolename]"; @UserRoles)| )
If HasRole(0) <> 0 Then
Continue = True
Elseif HasRole(0) = 0 Then
Msgbox "You do not have sufficient access to use this view.", 0 + 16,
"Unauthorized Access"
Continue = False
End If
End Function
'=============================
' if you wish to call it from the Queryopen then don't forget....
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
' 1. "Option Declare" in the view Global (Options)
' 2. "Option Declare" and also "Use "name_of_your_script_library" " in the
View (Options)
' 3. placing this (or something like it) in the Queryopen event of the view
"Call fnLockView(source, continue)"
This was first published in November 2000