Solved

Script not working on documents that cannot be edited

Posted on 2004-08-23
5
348 Views
Last Modified: 2013-12-18
I have a form and there are 2 fields - AuthorizedReader which is an Editable Readers field which allow user to enter multi users who can read only and another Authors Editable field called AuthorizedAuthor which allow user to enter multi users who can edit the document. The code below is to prevent the person who is listed in AuthorizedReader from switching to the edit mode and also display a message to let reader know that they are only allow to read.If the person who open this document is in the AuthorizedAuthor field, he/she will be able to edit the document.
But when the code below runs, it will display the message "You can read only" even when the user who open the document is one of the users listed in the AuthorizedAuthor field.

Code:
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
      Dim curdoc As notesdocument
      Dim item As notesitem
      Dim session As New notessession
      Dim x As Integer
      
      Set curdoc=Source.document
      Set item=curdoc.getfirstitem("AuthorizedAuthor")
      
      If Not (source.editmode) Then
            For x=0 To Ubound(item.values)
                  If session.commonusername<>item.values(x) Then
                        k="no"
                        Msgbox "You can read only!"                                              continue=False
                  Elseif session.commonusername=item.values(x) Then
                        k="yes"
                        continue=True
                        Goto memberofgroup                        
                        End
                                                 memberofgroup:
                        continue=True      
                  End If      
            Next
      End If      
End Sub

Pls advise.
Need this solution urgently.
Thanks.
0
Comment
Question by:kopibean
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11878465
Why do you need this ?  If they only have read access to the document, they can't switch to edit mode !

If they can, they have got MORE than Readers access to the document.  This is generally the case if the people in the Readers access field have higher access then Editor (so Editor, Designer or Manager) or if they are in the Authors field too.¨

Anyway, your script will fail because you compare strings that are not the same.  A better solution, if you want to stop higher-than-Editor access people to go into edit mode, is to create an Access Controlled section.  Make it span your entire document (put your entire document into the Access Controlled Section) and use as formula AuthorizedAuthors

Keep in mind that, just as this QueryModeChange stuff, this is NOT a watertight security measure.  People can still create agents to edit values in the document.
If you have the Designer, you can also skip the execution of QueryModeChange, and thus go into edit mode (open the debugger , and stop the script execution in the QueryModeChange).  Since your problem only occurs for higher access users, I bet they may also have a Designer client :-)

cheers,

Tom

0
 

Author Comment

by:kopibean
ID: 11878736
Hi Tom,

I do not understand this paragraph-A better solution, if you want to stop higher-than-Editor access people to go into edit mode, is to create an Access Controlled section.  Make it span your entire document (put your entire document into the Access Controlled Section) and use as formula AuthorizedAuthors

Could you kindly explain?
0
 
LVL 19

Assisted Solution

by:madheeswar
madheeswar earned 50 total points
ID: 11879470
I posted response to your previous question Kopibean.

Look into the code which I posted there.
0
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 50 total points
ID: 11881047
- Create an Access Controlled Section
- Put all your fields into that Access controlled Section
- Use as formula for Editors in the Access Controlled Section, the name of your field, AuthorizedAuthor

And check the Designer help on Access controlled sections :-)

Tom
0
 

Author Comment

by:kopibean
ID: 11888425
madheeswar,

I have reply your in my previous question.
Please kindly reply me.Thank you.


Tom,
I have try your solution but users not listed in the AuthorizedAuthor field are able to edit the document.
I'm not sure on this statement ->Use as formula for Editors in the Access Controlled Section, the name of your field, AuthorizedAuthor.

Could you kindly guide me?
Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.5 1 140
How to Open Lotus Notes:// links in web browser 3 1,412
Lotus notes Formula to trigger Lotusscript 1 501
Save conflict messages on existing documents 15 55
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now