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



Sep 12, 2011, 12:27 PM
66 Posts
topic has been resolvedResolved

How can I get user roles from the other database in xPages app?

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 5
 I have a xPages app, that is separate aplication and takes data (views and documents) from different existing application. We just dont want to mix design of both together. Its easy to do, because view and document datasources can be connected to different app so its very transparent. But we found conceptual problem when using roles permissions. On xPages we need to check, whether use has some role in this 'other/second" database. In java using getContext().getUser().getRoles().contains(name) just checks role in our xPages(current) application. Is there an easy way how to determine, whether the user has certain role in other databases?
Sep 12, 2011, 4:49 PM
39 Posts
Re: How can I get user roles from the other database in xPages app?
Not sure if this is easy or not but you could
 
get the database you want the roles from
create a new acl object from that db
loop through the aclentries looking for the one you want
when you find it get the roles and look for the one you want.
 
using the ACL and ACLEntry classes
 
Thanks
-Toby
Sep 12, 2011, 7:04 PM
66 Posts
Re: How can I get user roles from the other database in xPages app?
 I thought about this aproach but users are members of groups or 'goups inside groups', and such groups have a roles .... so its not such straightforward ... I definitely hoped for some easier solution based on existing API I missed so far.
Sep 13, 2011, 1:01 PM
31 Posts
Will queryAccessRoles do the trick ?
var title:string = database.getTitle();database
title = "For database \"" + title + "\" you have the following access roles: ";
var roles = database.queryAccessRoles(session.getUserName());
if (roles.isEmpty()) {
return title + " none";
} else {
for (var i=0; i<roles.length; i++) {
title = title + " " + roles[i];
}
return title;
}
Sep 14, 2011, 7:20 AM
66 Posts
Re: How can I get user roles from the other database in xPages app?
 GREAT!! I havent noticed this under Database class, my shame :-(
Sep 14, 2011, 10:02 AM
53 Posts
Re: How can I get user roles from the other database in xPages app?
Make sure you read the help for queryaccessroles though - if a person is listed in the acl it won't check their group membership as well, so doesn't necessarily return all their roles. This may not be an issue for you, dependant on your ACL structure
 
To be honest, if you're creating your design in an app all the relevant access should be contained within that app. Of course document level security can be dealt with in the original database using reader fields, but if you're essentially trying to duplicate hide-whens on view links then you should think about re-creating that in the app with the design

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