Home > Domino Tips > Developer > Other > Looking up fields in documents protected with Readers fields
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

OTHER

Looking up fields in documents protected with Readers fields


Axel Nastansky
03.27.2002
Rating: -4.08- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


This tip exploits an ancient weakness in the security model of Notes databases. It describes how to retrieve values in documents that a particular user does not have access to because they are protected with readers fields.

Code

To hide documents from users in a database a developer adds fields of type "readers". Unless a user is listed in the readers field or an author field on the document they cannot open the document. However field values of this document are still displayed in categorized views within the database. The categories can be accessed programmatically with @DBColumn and the NotesViewNavigator class.

Note: The user does need at least reader access to the database.

1) Create a lookup view and display the field that you would like to look up in a category. Be sure not to set the "Don't show categories having zero documents" property of the view.

You have two options to get to the values displayed:

2a) You create a lookup using @DBColumn which will retrieve the entire column. (@DbLookup returns "Server Error: Entry not found in index").

3a) If you'd like to get a result similar to a @DBLookup you need to resort to the LotusScript using the ViewNavigatorClass. Here is a sample button script that returns the lookup value in a field named "results":

       On Click 
                Dim session As New NotesSession
                Dim workspace As New NotesUIWorkspace
                Dim db As NotesDatabase
                Dim view As NotesView
                Dim doc As NotesDocument
                Dim uiDoc As NotesUiDocument
                Dim navigator As NotesViewNavigator
                Dim results() As String
                Dim entry As NotesViewEntry
                Dim count As Integer
                
                Set uiDoc = workspace.currentdocument
                Set doc = uidoc.document
                Set db = session.CurrentDatabase
                Set view = db.GetView("($All)")
                Set navigator = view.CreateViewnavfromCategory(doc.LUValue(0))
                
                If navigator Is Nothing Then
                                 Exit Sub
                End If
                
                count = 0
                Set entry = navigator.GetFirst
                
                While Not entry Is Nothing
                                 
                                 Redim Preserve results(count)
                                 results(count) = entry.ColumnValues(1)
                                 Set entry = navigator.GetNext(entry)
                                 count = count + 1 
                Wend
                
                doc.Results = results 
        End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Other
How to apply XSL style sheets to XML views
Comparing replicas on clustered Lotus Domino servers
Creating a Lotus Notes view column categorized by month
Using the XMLHTTP object for integration with Domino or any RDBMS back end
Hiding field properties/data from DocProperties box
Export a view to Excel without coding
Prevent document deletion if there are response documents
Switching between test IDs quickly
AddParameter to a NotesXSLTransFormer
Using DXL (Domino XML) to review/modify documents

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts