Hi Experts,
I have used the below code to get the roles assigned to a particular user.
I need to find whether my role Role:A is in the list.
If it is present in the list then i have to perform some activity like hidding some fileds from the view and displaying others.
IWDClientUser wdUser = WDClientUser.forceLoggedInClientUser();
IUser user = wdUser.getSAPUser();
String strRoleID = "", strRoleDesc = "";
IRoleFactory iRoleFactory;
iRoleFactory = UMFactory.getRoleFactory();
// Get All the Roles of the User
Iterator iteratorRoles = user.getRoles(true);//prtRequest.getUser().getRoles(true);
// Loop through all the Roles
while(iteratorRoles.hasNext())
{
strRoleID = iteratorRoles.next().toString();
try
{
strRoleDesc = iRoleFactory.getRole(strRoleID).getDescription();
String str = "ALSS";
if((strRoleDesc).trim().equals(str))
{
wdContext.currentContextElement().setSecondCont(WDVisibility.VISIBLE);
wdContext.currentContextElement().setDebug("1");
}
else
{
wdContext.currentContextElement().setSecondCont(WDVisibility.BLANK);
When i use this my code goes to the else part. And I have checked that the role ALSS is present in the list. Please advice where i am going wrong.
Points will be given for helpful answers.
Regards,
Sanjyoti.