Hide/Load components depends on User role in XPages

Sometime you may want to load the component or make the component visible depends on the current user’s role.

Lotus notes domino

Here’s a quick tip to do in SSJS

1. Check if it requires user to have a single role

var r:Array = database.queryAccessRoles(session.getEffectiveUserName());
@IsMember("[ROLE]", r);

2. Check if it requires user to have multiple roles

var r:Array = database.queryAccessRoles(session.getEffectiveUserName());
var a:Array = new Array("[ROLE1]", "[ROLE2]");
@IsMember(a, r);

Related posts:

Share
Tags: , ,

About number.0