[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

How to open the document based on user roles?

Asked by kopibean in Lotus Domino Email Server, Lotus Notes

Tags: Lotus Notes

I have create a checkbox field called Notify and in this field, it contains All, DHSG,DHP,DHT,DKL.
I have also created roles called All, DHSG,DHP,DHT,DKL.
I have another field called editaccess which contains the names who can edit the document.

E.g. 1 if the document "Notify" field is checked DHSG and the person A roles is checked as DHSG, then he can open this document to read only or else he cannot open this document.
E.g. 2, if the document "Notify" field is checked DHSG and the person A roles is checked as DHSG and he is listed in the editaccess field, then he can open this document to edit or else he cannot open this document.
My formula is in the queryopen and querymodechange events.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim acl As NotesACL
	Dim entry As NotesACLEntry
	Dim np As Variant
	Set db = session.CurrentDatabase
	Set acl = db.ACL
	Set entry = acl.GetEntry( session.UserName )
	Set uidoc = ws.CurrentDocument
	
	np = uidoc.FieldGetText("Notify")
	If ( entry Is Nothing ) Then
		continue = False
	Elseif Not ( entry.IsRoleEnabled( "DHSG" )=np) Then 
		continue = False
	End If
End Sub
 
===============================================================
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
	Dim curdoc As notesdocument
	Dim item As notesitem
	Dim session As New notessession
	
	
	Set curdoc=Source.document
	Set item=curdoc.getfirstitem("editaccess")
	
	If Not (source.editmode) Then
		For x=0 To Ubound(item.values) 
			If session.username<>item.values(x) Then
'do nothing
				k="no"
			Else
				k="yes"
				continue=True
				Goto memberofgroup
			End If
		Next
		If k="no" Then
			Msgbox "You can only read this document"
			continue=False
			End
		End If
memberofgroup:
		Msgbox "You are going to make changes to this document!"
		continue=True
		
	End If
End Sub
[+][-]10/26/09 02:41 AM, ID: 25660704Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/26/09 02:41 AM, ID: 25660709Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/27/09 01:51 AM, ID: 25670221Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/28/09 07:35 PM, ID: 25690221Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93 - Hierarchy / EE_QW_3_20080625