UserMBean (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.catalina.mbeans, class: UserMBean

# Class UserMBean

java.lang.Object
org.apache.tomcat.util.modeler.BaseModelMBean
org.apache.catalina.mbeans.UserMBean

All Implemented Interfaces:
  `DynamicMBean, MBeanRegistration, ModelMBeanNotificationBroadcaster, NotificationBroadcaster`

public class UserMBean extends BaseModelMBean

A ModelMBean implementation for the `org.apache.catalina.User` component.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final ManagedBean`
  `managed`
  The `ManagedBean` information describing this MBean.
  `protected final Registry`
  `registry`
  The configuration information registry for our managed beans.

  ### Fields inherited from class BaseModelMBean

  `attributeBroadcaster, generalBroadcaster, managedBean, oname, resource, resourceType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UserMBean()`
  Constructs a new UserMBean.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addGroup(String groupname)`
  Add a new `Group` to those this user belongs to.
  `void`
  `addRole(String rolename)`
  Add a new `Role` to those this user belongs to.
  `String[]`
  `getGroups()`
  Returns the MBean Names of all groups this user is a member of.
  `String[]`
  `getRoles()`
  Returns the MBean Names of all roles assigned to this user.
  `void`
  `removeGroup(String groupname)`
  Remove a `Group` from those this user belongs to.
  `void`
  `removeRole(String rolename)`
  Remove a `Role` from those this user belongs to.

  ### Methods inherited from class BaseModelMBean

  `addAttributeChangeNotificationListener, addNotificationListener, getAttribute, getAttributes, getClassName, getJmxName, getManagedResource, getMBeanInfo, getModelerType, getNotificationInfo, getObjectName, invoke, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedBean, setManagedResource, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### registry

    protected final Registry registry
    The configuration information registry for our managed beans.

  - ### managed

    protected final ManagedBean managed
    The `ManagedBean` information describing this MBean.

- ## Constructor Details

  - ### UserMBean

    public UserMBean()
    Constructs a new UserMBean.

- ## Method Details

  - ### getGroups

    public String[] getGroups()
    Returns the MBean Names of all groups this user is a member of.
    Returns:
      the MBean Names of all groups this user is a member of

  - ### getRoles

    public String[] getRoles()
    Returns the MBean Names of all roles assigned to this user.
    Returns:
      the MBean Names of all roles assigned to this user

  - ### addGroup

    public void addGroup(String groupname)
    Add a new `Group` to those this user belongs to.
    Parameters:
      `groupname` - Group name of the new group

  - ### addRole

    public void addRole(String rolename)
    Add a new `Role` to those this user belongs to.
    Parameters:
      `rolename` - Role name of the new role

  - ### removeGroup

    public void removeGroup(String groupname)
    Remove a `Group` from those this user belongs to.
    Parameters:
      `groupname` - Group name of the old group

  - ### removeRole

    public void removeRole(String rolename)
    Remove a `Role` from those this user belongs to.
    Parameters:
      `rolename` - Role name of the old role