Hi,
I’m trying to set the visibility for buttons in an XPage. This depends on the roles the user has in different database.
I can get the array of roles which I convert to a string and give it to a session Scope variable name dbRoles.
The array aRoles contains the roles that the user needs to have to get the button displayed.
Here’s my code under the Visibility of the button:
var x;
var aRoles = new Array();
aRoles[0] = “[approver]”;
aRoles[1] = “[manager]”;
var found = new Boolean(false);
var curRoles = sessionScope.dbRoles;
for (x in aRoles)
{
if(curRoles.indexOf(x) != -1){
found = true;
break;
}
}
if (found == true) {
return true;
}
else {
return false;
}
I tried it using a string instead of an array and it worked fine. (I used “[approver]” and I removed the For loop.)
Thank you for your help,
Etyien