Skip to Content
avatar image
Former Member

Getting portal roles in Application

Hi all,

I am using the following code to get the username and role from portal.

<b>String logonID = " ";

IWDClientUser wdUser = null;

try {

wdUser = WDClientUser.getCurrentUser();

} catch (WDUMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

IUser user = wdUser.getSAPUser();

logonID = user.getFirstName();

wdContext.currentContextElement().setUsername(logonID);

try {

if(user!=null)

{

IUserAccount[] acct = user.getUserAccounts();

if(acct[0]!=null)

{

String strUser = acct[0].getLogonUid();

Iterator it = acct[0].getRoles(true);

while(it.hasNext())

{

String rolename = it.next().toString();

wdContext.currentContextElement().setRolename(rolename);

}

}

}

} catch (UMException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}</b>

I am able to get the username but i am not getting the role of the user. The cursor is not going into the while loop. I have written this code in component controller.

I want to check whether admin role is assigned to a particular user.

Can some body suggest me the correct code?

Thanks in advance,

Gopi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 23, 2006 at 03:36 PM

    Hi,

    Have a look at this threads

    getting-portal-users-role

    Regards,

    Saravanan K

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi G Nid,

      Populate all assigned roles for particular user and store it in Hashmap. Check your roles with the haspmap list.

      Regards

      Suresh