Prevent Access To View Contents (Even If Ctrl+Shift Was Used)

Prevent Access To View Contents (Even If Ctrl+Shift Was Used)

I'm sure many of us are familiar with the CTRL+SHIFT trick to access hidden
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.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.


' 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

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.