Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 869
The Raven Avatar asked Feb 18 '14 12:02

The Raven


Video Answer


1 Answers

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.

like image 147
Per Henrik Lausten Avatar answered Oct 24 '22 21:10

Per Henrik Lausten