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



May 25, 2011, 8:11 PM
27 Posts

Error:'@UserRoles' not found

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role:
  • Tags: @UserRoles
  • Replies: 5
 Can anyone tell me how to express the LotusScript:
 
 @IsMember("[Administrator]", @UserRoles)
 
... as server side javascript on an XPage?
 
Many thanks in advance! 
 
May 25, 2011, 9:22 PM
27 Posts
Re: Error:'@UserRoles' not found
 ...perhaps a little context might help:  I'm try to do a hide-when type of thing with code like this:
 
<xp:tr>
<xp:this.rendered><![CDATA[#{javascript:
try {
return @IsMember("[Administrator]",@UserRoles);
} catch(e) {}
}]]></xp:this.rendered>
<xp:td styleClass="label">Hello Administrator</xp:td>
</xp:tr>
 
...however this throws the error "Error: '@UserRoles' not found".  Is there something I need to do to access @UserRoles?  Is @UserRoles not a standard @Function? 
May 25, 2011, 11:38 PM
2 Posts
Re: Error:'@UserRoles' not found
Hi 
 
take a look at the context object (a global object) and the method getUser(). It will give you a user object (directoryuser) with a lot of nice user-related methods, getRoles() for example.
 
context.getUser().getRoles().contains("<role>") should solve your problem. 
 
 
Fredrik 
 
 
 
 
May 26, 2011, 4:51 PM
27 Posts
Re: Error:'@UserRoles' not found
 Many thanks Fredrik - That was exactly what I needed!
May 26, 2011, 5:17 PM
1 Posts
Re: Error:'@UserRoles' not found
Try also with @UserRoles()
 
It is a function...
Jun 1, 2011, 9:23 AM
3 Posts
Re: Error:'@UserRoles' not found
Try
 
 context.getUser().getRoles().contains("[Administrator]" ) 
 
I think the database needs to have "Enforce a consistent Access Control List across all replicas" option checked.
 
 
Never mind.. Didn't see  Fredrik's replies
Simon 

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