Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Script not working on documents that cannot be edited

Posted on 2004-08-23
5
Medium Priority
?
356 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 200 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

671 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