Is there a way to prevent an xpage from going into edit mode?
How do I prevent someone without edit access from editing a document by changing the url (&action=editDocument")?
Is there a way to prevent an xpage from going into edit mode?
How do I prevent someone without edit access from editing a document by changing the url (&action=editDocument")?
Subject: Three thoughts…
Standard access controls should apply. If the user can’t edit, then the XPage not go to edit mode.
In postOpenDocument do some check against the current user. If the check fails either redirect the page to a read-only URL or reload the previous page. One would think queryOpenDocument could do this, but I’ve never seen qOD do anything other than print to the server console, reliably. At least pOD works.
Dang. Slipped away whilst typing.
Hope this helps…
Subject: Document Locking
I also wanted a way to check if someone is currently editing the document. If the document is being edit then it prevents other people from editing the document. The “beforePageLoad” event would redirect them to read mode, until the document is unlocked. The document is unlock when the current editor close the document. Or my schedule agent unlocks the document after its being open for more than 30 minutes.
Subject: Got it Working
I added this code to beforePageLoad event.
currDoc=currentDocument;
var v:Array = database.queryAccessRoles(session.getEffectiveUserName());
var userName:NotesName = @Name(“[CN]”, session.getEffectiveUserName());
var Authors:Array=currDoc.getItemValue(“Authors”);
if(currentDocument.isEditable())
{
if(@IsMember(userName, Authors))
{
//You have access to edit the document
}else{
//You do not have access to edit the document
var url=view.getPageName()+"?action=openDocument&documentId="+currDoc.getNoteID();
context.redirectToPage(url);
}}