|
Hi all. I posted a topic a while ago regarding the messiness of private views in a Notes Client. After quite a bit of research, and some queries to IBM themselves, I've managed to find a middle ground when it comes to viewing private data.
First thing's first. The solution I at last found to work properly, is private folders. Just to recap from my last argument....private Views returned dodgy results, and always seemed to be inconsistent. The alternatives were to use either embedded views that show data using a Single Category, or @SetViewInfo. While this sort of worked, you had the problem of "Select All", searching, slow indexing, etc.
With Private Folders, i managed to eliminate the slow indexing, return the selection and searching capabilities, and most importantly, confirm that they work when the design of the Lotus Notes Application is hidden.
Before I explain how to implement this, I want to make sure everyone understands why we are going this route. One of my projects last year, was to implement a HR Solution that is used by 4000 odd employees. The views in this HR Solution had very technical access rights that needed to be assigned to them. Let's say you have a Salaries View, and when opened, needs to return documents based on usernames and roles. (i.e. only show entries in this view if you have the HRAdmin or Director Role, if it's your own salary Document, or if it's entries of those that work underneath you). Immediately, you can see that setting the Access in the View Properties is out of the question, and the need for a Private View is in order. Readers and Authors fields are also not an option, as you need to see personal details in that associate document. Encrypting fields becomes messy, and annoys users with the prompts, etc. Finally, because private views are somewhat unstable, Private folders need to be implemented.
Now, to implement a Private Folder in your solution, you will need a backend view that categorizes all relevant documents by Usernames that are stored in the names fields in the Notes Form. This view will be used to feed data into the private folder when in use. In the Query Open Event of the Private Folder, you will run a "RunAgent" or "ToolsRunMacro" command, that will initiate an agent that searches the backend view by Username, and populates the data into the Private Folder. Please note, you cannot use LotusScript in the QueryOpen or QueryClose event of the Private Folder, as the Lotusscript will not run when the design of the database is hidden. I learned this the hard way.
Please take note of the following:
1. The Folders you create for the users need to be "Shared, Private on First Use". 2. Users and Groups affected, need to have "Create Personal Folders/View" checked/enabled in the Database's ACL.
Finally, I would suggest adding the code below to the "QueryClose" event in the Database Script. This code will delete all Private Folders for the user, so as to allow new design changes made to the folders reflect immediately. It also keep the database design as clean as posssible. This code is generic, and need not be modified.
I hope this is not too technical, and I hope you get the value from it that I have gotten. I will be more than happy to answer any questions regarding this. You can either leave comments here, or e-mail me at john.jardin@gmail.com
Cheers John
Sub Queryclose(Source As Notesuidatabase, Continue As Variant) ' VARIABLES Dim ss As New NotesSession Dim db As NotesDatabase Dim notecol As NotesNoteCollection Dim doc As NotesDocument Dim nid As String Dim nextid As String Dim i As Integer ' CODE Set db = ss.CurrentDatabase Set notecol = db.CreateNoteCollection(False) notecol.SelectFolders = True Call notecol.BuildCollection nid = notecol.GetFirstNoteId For i = 1 To notecol.Count nextid = notecol.GetNextNoteId(nid) Set doc = db.GetDocumentByID(nid) If Not( doc Is Nothing ) Then If doc.hasItem("$Flags") Then If Instr(doc.~$flags(0),"FYV") Then If doc.~$Readers(0) = ss.UserName Then Call doc.RemovePermanently(True) End If End If End If End If nid = nextid Next Print "Private Folders Deleted" End Sub
|
Ratings
0
|