OpenNTF.org - Agent to explain your read/edi
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
Agent to explain your read/edit access to a document 
Rating:
Rating: 4 , Number of votes: 2 
Contributor:
Andre Guirard 
Category:
Lotusscript 
Type:
Debugging 
Document Release:
1.0 
Notes Version:
R6.x, R5.x, R7.x 
Last Modified:
21 Mar 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
There seems to be a lot of misunderstanding surrounding readers and authors fields. I posted a FAQ on the subject (http://www-10.lotus.com/ldd/46dom.nsf/11a0b6a64ffb3d8d85256a4c004f1bbd/e0359d10a2307d1885256c61000707b7?OpenDocument) but it's still not easy to scan all the fields in a document to figure out why you should, or should not, have access to read or edit the document.


So, I wrote a little agent to take the selected document and report on the current user's access to it. This can be installed as part of the design of an application under development (or maintenance). The user highlights the document in a view and runs the agent, and it produces an explanation of exactly why the user can (or cannot) view and edit the document, with reference to specific fields.

I'm not sure this is 100% accurate, so if you try it and it reports results contrary to your experience (e.g. if it says you can edit the document and you actually cannot), please comment in reply to this post. However, before you do so, please make sure the problem is really with the access and not, for example, that there's a Queryopen event preventing the document from opening in edit mode.

The agent will look at the currently highlighted document in the view. It will refuse to operate on a document that's open on-screen because it may contain default or computed name fields that show values different from those stored in the document -- and it's the ones stored in the document that count.

The agent is also designed to work on a document in another database, specified by means of an environment variable. This lets you store the agent in one place -- say, your mail file -- and give yourself a toolbar icon to invoke it.

TOOLBAR FORMULA:
_unid := @Text(@DocumentUniqueID);
ENVIRONMENT PARAM1 := @Implode(@DbName:_unid; ",");
@Command([MailOpen]);
@Command([ToolsRunMacro]; "ExplainMyAccess")

AGENT SETTINGS: Run from menu, run on "None", name "Whatever you want|ExplainMyAccess".
You can make it run from agent list, but keep the alias, e.g. "(Your chosen name)|ExplainMyAccess".

AGENT CODE: see attachment.

Notes:
- The agent tests for and warns about fields that contain comma/semicolon (looks like they contain multiple names but aren't multivalued).
- There is logic that can conclude that you that you don't have access to read the document; this would obviously not be correct, except if you're accessing the application thru full access administration, where you can read this as you wouldn't _normally_ have read access to this document.
- The output is displayed in a memo body. We expect you might want to have users run agent and email you the results -- this makes it easy.

Usage / Example
Find a database to which you have Author access and can edit documents you create. The Notes/Domino forums on IBM developerWorks is a good example, if you have set up to access them with a Notes client. Highlight one of your own documents and use your toolbar icon to invoke the ExplainMyAccess agent. This will open your mail file, then show your results in a new memo, as follows:

READERS FIELDS: -none-
AUTHORS FIELDS: From

READ ACCESS:You CAN read this document.
The document doesn't contain any non-blank readers fields. Anyone with Reader access or higher can view it.

EDIT ACCESS:You CAN edit this document.
You are listed in the Authors field From as (CN=Andre Guirard/OU=Cambridge/O=IBM).
Code Attachments
 Comments
Posted by Ray Weber on 03/28/2006 02:49:29 AMnice work!
Nice work, very usefull for applications with a lot of author/reader fields i.e. workflow-apps. Works awesome in LN 6.x
Unfortunately, it does not work in R5, due to the use of boolean data-type and richtextitem.update method.
Posted by tim hutto on 08/15/2006 02:55:14 PMExplain Invisible Sun
Useful for Author fields, but if you can read a document, then you can't select it in a view to find out why you can't read it. Would be better if I could run it against other users.
Posted by Andre Guirard on 08/15/2006 03:12:59 PMyes, it would be nice...
...and as soon as the LotusScript team provides me a function that will return a list of the groups and roles of a specified username, I'll gladly update my code to make use of it. Or, do you have a pointer to such a function? It sounds like too much work.
 Add your comment!