To get user: data.getUser().getUserName(). Then use the following code
to get the role value....in our case we just had one role associated
with a user therefore it retrieves the first GroupRole object to get the
value. The same can be used to get the group name for the user.

  public String getRole (String userName)
  {
        try
        {
                Iterator userRoleList = JetspeedSecurity.getRoles
(userName);
                //The iterator that comes back from the above api
contains multiple
                //GroupRole objects. Since the implementation is such
that
                //each user has only one role therefore the role name is
obtained
                //from the first GroupRole object.
            String roleName = ((GroupRole)
userRoleList.next()).getRole().getName();
//to get group: ((GroupRole) userRoleList.next()).getGroup().getName();
            return roleName;
        }
        catch (JetspeedSecurityException e)
        {
                e.printStackTrace();
        }
        return "";
  }

-----Original Message-----
From: Bhaskar T [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 01, 2005 5:26 AM
To: jetspeed-user@jakarta.apache.org
Subject: How to get a logged in users Role and Group

Hi All,

How should I get the logged in users ROLE and GROUP in the
top_loggedIn.jsp

Thanks in Advance
Bhaskar

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to