# com.bea.p13n.controls.userInfoQuery
UserInfoControl Interface

public interface UserInfoControl
extends `Control`

This control is used to query information about a particular user, such as which groups the user belongs to, which roles the user is in, which roles are available to the user.
Security requirements: The caller must be in the role of "PortalSystemAdministrator" to invoke method 'getAllGroupNames()

All Superinterfaces
  `Control`, `Control`, `Serializable`

## Method Summary

`public void` | `authenticate`(`String` username, `String` password) Authenticate a user.
`public `List`` | `getAllGroupNames`() Get a List of all group names in the system
`public `String`` | `getAuthenticatedUserId`(`HttpServletRequest` request) Get the authenticated user from the request object
`public `List`` | `getAvailableUserRoles`(`HttpServletRequest` request) Get a list of role names that the user is in
`public `List`` | `getGroupNamesForUser`(`String` username) Get a list of groups to which this user belongs
`public `List`` | `getUserGroupNames`(`HttpServletRequest` request) Get a list of groups to which this user belongs
`public boolean` | `isCurrentUserInRole`(`HttpServletRequest` request, `String` roleName) Determine whether this user is allowed in this particular role
`public boolean` | `isMemberOfGroup`(`String` groupname, `String` username) Determine if a user is a member of a group.
`public boolean` | `userIsRegistered`(`HttpServletRequest` request) Determine whether this user is a registered user type

## Method Detail

### authenticate(String, String) Method

    public void authenticate(String username,
                             String password)
         throws P13nControlException

Authenticate a user. This method is only used to verify a username and password. It does not do anything to "log in" or set the user as the "current" system user.

#### Parameters

username
  the username for the user

password
  the password for the user

#### Exceptions

``P13nControlException``
  if the user is not a valid user or credentials are incorrect

### getAllGroupNames() Method

DEPRECATED Use GroupProviderControl.getAllGroupNames()

    public List getAllGroupNames()
         throws P13nControlException

Get a List of all group names in the system

#### Returns

a List of all group names in the system

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing GroupManager EJB or if user is not in the role of 'PortalSystemAdministrator' or 'Portal'

### getAuthenticatedUserId(HttpServletRequest) Method

    public String getAuthenticatedUserId(HttpServletRequest request)
         throws P13nControlException

Get the authenticated user from the request object

#### Parameters

request
  the HttpServletRequest object

#### Returns

the username of the authenticated user, or null if not authenticated

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing EJB

### getAvailableUserRoles(HttpServletRequest) Method

    public List getAvailableUserRoles(HttpServletRequest request)
         throws P13nControlException

Get a list of role names that the user is in

#### Parameters

request
  the HttpServletRequest object

#### Returns

a List of role names (String) available to this user or null if no roles exist for this user.

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing EJB

### getGroupNamesForUser(String) Method

DEPRECATED Use GroupProviderControl.getGroupNamesForUser(username)

    public List getGroupNamesForUser(String username)
         throws P13nControlException

Get a list of groups to which this user belongs

#### Parameters

username
  Current user name

#### Returns

List of group names (String) to which the user belongs

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing GroupManager EJB

### getUserGroupNames(HttpServletRequest) Method

DEPRECATED Use GroupProviderControl.getGroupNamesForUser(username)

    public List getUserGroupNames(HttpServletRequest request)
         throws P13nControlException

Get a list of groups to which this user belongs

#### Parameters

request
  object, which will contain current user name

#### Returns

List of group names (String) to which the user belongs

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing GroupManager EJB

### isCurrentUserInRole(HttpServletRequest, String) Method

    public boolean isCurrentUserInRole(HttpServletRequest request,
                                       String roleName)
         throws P13nControlException

Determine whether this user is allowed in this particular role

#### Parameters

request
  the HttpServletRequest object

roleName
  The name of the role, defined as one of the available Portal roles

#### Returns

true if the named role is available for the user

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing EJB

### isMemberOfGroup(String, String) Method

DEPRECATED Use GroupProviderControl.getAllGroupNames()

    public boolean isMemberOfGroup(String groupname,
                                   String username)
         throws P13nControlException

Determine if a user is a member of a group.

#### Parameters

groupname
  the group to query

username
  the user to look for

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing GroupManager EJB

### userIsRegistered(HttpServletRequest) Method

    public boolean userIsRegistered(HttpServletRequest request)
         throws P13nControlException

Determine whether this user is a registered user type

#### Parameters

request
  the HttpServletRequest object

#### Returns

true if the user is of registered user type

#### Exceptions

``P13nControlException``
  if remote exceptions encountered accessing backing EJB