a more user friendly interface for the users. Some of these views may only be
read-accessible by the users with certain roles, say DBManager role. If we set
the view access to restrict user read access only for users with DBManager
role, other users will encounter an error message 'view does not exist' when
they click on these views on the navigator. To resolve this, we can use
@UserRoles to determine the role of the user and issue a more user-friendly
message 'You are not authorised to access this option.'
If we use the open database launch option 'open designated navigator in its own
window', @UserRoles will only work for R4.6x and above. For R4.5x and below,
@UserRoles will be empty as the database is not fully opened yet. To resolve
this problem, we can put the following Script(A) in PostOpen event of Database
Script, to pass down an environment variable, and retrieve it from the
navigator using Formula(A).
Sub Postopen(Source As Notesuidatabase)
Dim Session As New NotesSession
Dim URole As Variant
Dim MyRole As String
URole = Evaluate("@UserRoles")
MyRole = ""
Forall ur In URole
If ur = "[DBManager]" Then
MyRole = "DBManager"
Call Session.SetEnvironmentVar("LoginUserRoles", MyRole)
Formula(A) : In the Navigator, determine role before opening a view
GetUserRoles := @Environment("LoginUserRoles");
@If(GetUserRoles != "DBManager"; @Return(@Prompt([OK]; "Not Authorised"; "You
are not authorised to access this option.")); @Command([OpenView]; "DBMgr