For an xpage-application with java beans i need to check if a certain user(not current user) has reader-access to a document. All acceslevels above (Database ACL, XPage ACL...) can be taken for granted. Current User is always at least author.
Each document has one readerfield "readers" and three authorfields "creator","authors","AdminAuthor", last can be ignored,since it always only contains "[Admin]" for every document
Current idea is to get the groups of the user like showed here(Determine all groups for a defined user), loop through them and compare to the reader and author fields field content
Why i don't like it:
- use of an undocumented API
- horrible performance
Is there any better way to do so? Especially with nested groups in mind, so $ServerAccess view is not really an option.
Current code:
public boolean isReader(String notesName, String documentID){
try {
Vector<String> readers= getAllReaderFieldsValues(documentID);
if(readers.contains(notesName)){
return true;
}
lotus.notes.addins.DominoServer server = new lotus.notes.addins.DominoServer(DominoUtils.getCurrentSession().getServerName());
for(String group:(Vector<String>)server.getNamesList(notesName)){
if (readers.contains(group)){
return true;
}
}
} catch (NotesException e) {
//ErrorHandling
}
return false;
}
Thanks for any help