I want to show a button when the current user has Author rights or if the current user is a member of a group, that has those rights.
This is how I tried to implement it, inside the rendered
property of my button:
var cxt = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent();
var isEditable = cxt.isDocEditable(currentDocument.getDocument());
return isEditable;
In my case isEditable
is always true.
Can someone tell me if and what I am doing wrong, please?
Thank you in advance.
It seems I was foolish enough to skip over the Author
access and tested with Manager
, Editor
, Reader
only.
Big thanks to @Paul Stephen Withers and @Per Henrik Lausten for leading me towards the solution.
For further reference, if someone needs it, here is how I show/hide the edit/hide the save buttons, depending on the read/write mode of the document:
// Save button
var showButton = currentDocument.isEditable();
var contxt = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent();
var isEditable = contxt.isDocEditable(currentDocument.getDocument());
return (isEditable && showButton);
// Edit button
var showButton = !currentDocument.isEditable();
var contxt = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent();
var isEditable = contxt.isDocEditable(currentDocument.getDocument());
return (isEditable && showButton);
Make sure that you test with a user with author access in the ACL of the database.
Your code will always return true for users with editor access.