检查方式是用户是文档作者吗? [英] Way to check is an user a document author?
问题描述
您好,Domino程序员!
Hello Domino programmers!
我在Lotus数据库+ xpages上工作,遇到以下问题:
I work on a lotus database + xpages and i ran into a following problem:
我在文档上有作者"和读者"字段,并且都可以包含用户和组. 这两个字段都是使用NamePicker控件在XPage上设置的. 保存文档后,如果用户无权隐藏文档,我想隐藏一个编辑"按钮.
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.
是否有一种方法可以仅检查文档,数据源或上下文-如果当前用户是文档作者?还是我要一直检查它,比较Authors字段-多个用户名和组与当前用户名?
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?
任何帮助将不胜感激.
推荐答案
您可以使用Java方法NotesContext.isDocEditable(document)
来检查用户是否可以编辑文档.
You can use the Java method NotesContext.isDocEditable(document)
to check if user can edit the document.
在SSJS中,您可以执行以下操作:
In SSJS you can do this:
var ctx = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent();
return ctx.isDocEditable(doc);
此方法也可用作为XSnippet .
这篇关于检查方式是用户是文档作者吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!