Way to check is an user a document author?

2019-04-06 09:23发布

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.

1条回答
孤傲高冷的网名
2楼-- · 2019-04-06 10:07

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.

查看更多
登录 后发表回答