Way to check is an user a document author?
Hello Domino programmers!
I work on a lotus database + xpages and i ran into a following problem:
I have Authors and Readers fields on document and both can contain users and groups. Both fields are set on XPage using NamePicker control. When document is saved i would like to hide an "Edit" button when user doesn't have rights to do so.
Is there a way to just check on document, datasource or context - if current user is document author? Or i have to check it all way long, comparing Authors fields - multiple usernames and groups with current username?
Any help will be appreciated.
You can use the Java method NotesContext.isDocEditable(document) to check if user can edit the document.
In SSJS you can do this:
var ctx = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent(); return ctx.isDocEditable(doc);
This method is also available as an XSnippet.