Solved

Script not working on documents that cannot be edited

Posted on 2004-08-23
5
345 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

24 Experts available now in Live!

Get 1:1 Help Now