Hi,
You can write a SSJS (Server Side Java Script) library function as below, and then include this script library into your relevant xpage or custom control.
/*
* Role Checking
* This function will check if the current user has the role that you pass to this function
* The return value of this function is either 'true' or 'false'
*/
function checkCurrentUserRole(strRole){
var x = context.getUser().getRoles().contains('[' + strRole + ']');
return x;
}
PS: When you are passing strRole then pass it without the square brackets for example checkCurrentUserRole("Editor") etc.
Hope this helps, if you need anything else then let me know.
Regards
Neeraj