Hi,
From an XPages application, I need to check if the current user has access to another database.
Here’s my code:
var remoteDb:NotesDatabase = session.getDatabase(server,path,false);
if (remoteDb != null) {
var aDbAccess:Array = remoteDb.queryAccess(session.getEffectiveUserName());
var aDbRoles:Array = remoteDb.queryAccessRoles(session.getEffectiveUserName());
sessionScope.put(‘DbAccess’, remoteDb.queryAccess(session.getEffectiveUserName()));
sessionScope.put(‘DbRoles’, aDbRoles.join());
sessionScope.put(‘DbTitle’, remoteDb.getTitle());
}
This works fine if the user has access to the remote database, however, if he doesn’t, it fails. I guess it must be very trivial but I can’t see why it’s not working. Is the remoteDb object not null if the database can’t be opened?
Thanks for your help,
Etyien