This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 14, 2012, 3:51 PM
20 Posts
topic has been resolvedResolved

queryAccess on Web

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: XPages,Web
  • Replies: 2
 In an XPages application, I want to restrict users with Reader of lower access from executing a function that includes saving a document.  To check their access level, I use the following code:
 
var db=session.getCurrentDatabase(); 
var user=session.getUserName(); 
var accesslevel=db.queryAccess(user); 
 
I condition the saving of the document on accesslevel >= 3  (2=Reader, 3=Author, etc.) 
 
This works correctly on a Notes client, but on the Web it attempts to save the document regardless of the access level.  Does the queryAccess function not work on a Web browser? 
 
Jun 14, 2012, 5:51 PM
20 Posts
Re: queryAccess on Web
 Doh!
Should have used getEffectiveUserName(). 
On a Web browser, getUserName() returns the SERVER name. 
Jun 16, 2012, 11:53 AM
586 Posts
Re: queryAccess on Web
 If you're using the ext. library there's now a "userBean" that can make something like this nice and easy.  I don't have an example handy but I'm pretty sure there's one detailed in the Ext. Library book.
 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal