Solved

Script not working on documents that cannot be edited

Posted on 2004-08-23
5
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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