Private documents

Hello,

in a form I will give the options “public” and “private” to allow users to restrict access or not. Public documents should be readable by everyone, private documents on the other hand are restricted to users listed in a readers field.

Can anybody help me how to achieve this (with radio buttons)? Thanks a lot!

Subject: Private documents

Have an onChange event on the radio button that asks who should be in the readers field if “Private” is Selected. This event should also clear the readers field if public is selected and there are values in the readers field.

Have the event run on the change and trap so it does not rerun on the exit (a nasty bug in ND6 as far as I am concerned).

Here is an example of a Radio Button field asks for a choice similar to yours (asks if a document should be processed for the author or another individual):

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim uidoc As NotesUIDocument

Set uidoc=ws.currentdocument

Dim strChanged As String

’ THIS FIELD IS TESTED ON THE EXITING OF THE FIELD TO SEE IF A CHANGE HAS OCCURRED

strChanged=uidoc.FieldGetText

(“eqcoReserveChoiceChanged”)

Dim strChange As String

strChange=uidoc.FieldGetText

(“eqcoReserveChoiceChange”)

’ THIS TESTS TO SEE IF THERE WAS A CHANGE SO THE EVENT DOES NOT FIRE AGAIN WHEN EXITING THE FIELD

If strChanged<>“” Then

If stChanged = strChange Then

Messagebox "exiting sub"

Exit Sub

End If

End If

If strChange=“Another Individual” Then

Call uidoc.FieldSetText

(“eqcoReserveForPick”,“”)

End If

If strReserve=“Myself” Then

Call uidoc.FieldSetText

(“eqcoReserveChoiceChange”,strReserve)

Elseif strReserve=“Another Individual” Then

Call uidoc.FieldSetText

(“eqcoReserveChoiceChange”,strReserve)

Dim messagelist As String

Dim varName As Variant

varName=ws.PickListStrings(PICKLIST_NAMES,

False)

If ( Isempty( varName ) ) Then

Messagebox "Canceled" , , "Name selected"

Else

Forall n In varName

  Set nam = session.CreateName(n)

  Call uidoc.FieldSetText

  ("eqcoreserveForPick",Nam.Abbreviated)   

End Forall

End If

End If

Subject: Private documents

If your radiobotton field is called IsPrivate, with the following choices:

Private|1

Public|0

You simply create a Computed Readers field with the formula:

@If(IsPrivate=“1”; @UserName:“[Admin]”; “”);

If IsPrivate is marked as “Private” (actual field value “1”), then the editing user as well as anyone with the [Admin] role can read (give the Administrators group and LocalDomainServers the [Admin] rolw, to allow server replication etc).

If “Public” is selected, then the readers field is emptied, thus leaving everyone with access.

Subject: Private documents

Do it in your readers field.

variable := creator : reader1 : reader2 : reader3 ;

@If(radioValueField = “private” ;

variable ;

"")

Subject: RE: Private documents

I think to do this (which would be a simpler approach to what I did, but mine was done that way for a specific reason), I would modify it slightly so that the user could select the readers they wanted:

tmpReaders:=@if(RadioValueField!=“Private”;“”;

“creator” : “[Admins]”: @PickList( [NAME] ));

tmpReaders