Hello Domino programmers!
I work on a Xpages application and i ran into a following problem:
I have to use sessionAsSigner object to get number of all documents in a view. I use single computed field to display: user visible document count / all documents count value and another computed field to display current (not sessionAsSigner) user name.
Page looks as follows:
Under UserName Computed field code i entered following code:
session.createName(session.getEffectiveUserName()).getCommon()
Under DocCount Computed field code i entered following code:
var viewAsUser = database.getView("AllByHID");
var docCountUser = viewAsUser.getAllEntries().getCount();
var dbAsSigner = sessionAsSigner.getCurrentDatabase();
var viewAsSigner = dbAsSigner.getView("AllByHID");
var docCountSigner = viewAsSigner.getAllEntries().getCount();
return docCountUser.toString() + "/" + docCountSigner.toString();
I received following result:
This is correct number of documents a current user can see, but it seems like sessionAsSigner usage was completely ignored. (?)
After some "tinkering" I swapped some lines of code to get:
var dbAsSigner = sessionAsSigner.getCurrentDatabase();
var viewAsSigner = dbAsSigner.getView("AllByHID");
var docCountSigner = viewAsSigner.getAllEntries().getCount();
var viewAsUser = database.getView("AllByHID");
var docCountUser = viewAsUser.getAllEntries().getCount();
return docCountUser.toString() + "/" + docCountSigner.toString();
and in result...
Both values are correct, but i wonder why can't i get them in a single call? Am I missing something here?
Any help will be appreciated.