DataSourceUserDatabaseMBean (Apache Tomcat 9.0.68 API Documentation)

Package org.apache.catalina.mbeans

## Class DataSourceUserDatabaseMBean

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

- All Implemented Interfaces:
    `javax.management.DynamicMBean`, `javax.management.MBeanRegistration`, `javax.management.modelmbean.ModelMBeanNotificationBroadcaster`, `javax.management.NotificationBroadcaster`

      public class DataSourceUserDatabaseMBean
      extends BaseModelMBean

  A ModelMBean implementation for the `org.apache.catalina.users.DataSourceUserDatabase` component.

  Author:
    Craig R. McClanahan

- - ### Field Summary

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

    - ### Fields inherited from class org.apache.tomcat.util.modeler.BaseModelMBean

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DataSourceUserDatabaseMBean()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addGroupRole​(java.lang.String groupname, java.lang.String rolename)` | Add role to a group.
    `void` | `addUserGroup​(java.lang.String username, java.lang.String groupname)` | Add group to user.
    `void` | `addUserRole​(java.lang.String username, java.lang.String rolename)` | Add specified role to the user.
    `void` | `changeUserPassword​(java.lang.String username, java.lang.String password)` | Change user credentials.
    `java.lang.String` | `createGroup​(java.lang.String groupname, java.lang.String description)` | Create a new Group and return the corresponding name.
    `java.lang.String` | `createRole​(java.lang.String rolename, java.lang.String description)` | Create a new Role and return the corresponding name.
    `java.lang.String` | `createUser​(java.lang.String username, java.lang.String password, java.lang.String fullName)` | Create a new User and return the corresponding name.
    `java.lang.String[]` | `getGroupRoles​(java.lang.String groupname)` | Get roles for a group.
    `java.lang.String[]` | `getGroups()` |
    `java.lang.String[]` | `getRoles()` |
    `java.lang.String[]` | `getUserGroups​(java.lang.String username)` | Get groups for a user.
    `java.lang.String[]` | `getUserRoles​(java.lang.String username)` | Get roles for a user.
    `java.lang.String[]` | `getUsers()` |
    `void` | `removeGroup​(java.lang.String groupname)` | Remove an existing group.
    `void` | `removeGroupRole​(java.lang.String groupname, java.lang.String rolename)` | Remove role from a group.
    `void` | `removeRole​(java.lang.String rolename)` | Remove an existing role.
    `void` | `removeUser​(java.lang.String username)` | Remove an existing user.
    `void` | `removeUserGroup​(java.lang.String username, java.lang.String groupname)` | Remove group from user.
    `void` | `removeUserRole​(java.lang.String username, java.lang.String rolename)` | Remove specified role from the user.

    - ### Methods inherited from class org.apache.tomcat.util.modeler.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 java.lang.Object

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

- - ### Field Detail

    - #### 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 Detail

    - #### DataSourceUserDatabaseMBean

          public DataSourceUserDatabaseMBean()

  - ### Method Detail

    - #### getGroups

          public java.lang.String[] getGroups()

      Returns:
        the names of all groups defined in this database.

    - #### getRoles

          public java.lang.String[] getRoles()

      Returns:
        the names of all roles defined in this database.

    - #### getUsers

          public java.lang.String[] getUsers()

      Returns:
        the names of all users defined in this database.

    - #### createGroup

          public java.lang.String createGroup​(java.lang.String groupname,
                                              java.lang.String description)

      Create a new Group and return the corresponding name.
      Parameters:
        `groupname` - Group name of the new group
        `description` - Description of the new group
      Returns:
        the new group name

    - #### createRole

          public java.lang.String createRole​(java.lang.String rolename,
                                             java.lang.String description)

      Create a new Role and return the corresponding name.
      Parameters:
        `rolename` - Group name of the new group
        `description` - Description of the new group
      Returns:
        the new role name

    - #### createUser

          public java.lang.String createUser​(java.lang.String username,
                                             java.lang.String password,
                                             java.lang.String fullName)

      Create a new User and return the corresponding name.
      Parameters:
        `username` - User name of the new user
        `password` - Password for the new user
        `fullName` - Full name for the new user
      Returns:
        the new user name

    - #### removeGroup

          public void removeGroup​(java.lang.String groupname)

      Remove an existing group.
      Parameters:
        `groupname` - Group name to remove

    - #### removeRole

          public void removeRole​(java.lang.String rolename)

      Remove an existing role.
      Parameters:
        `rolename` - Role name to remove

    - #### removeUser

          public void removeUser​(java.lang.String username)

      Remove an existing user.
      Parameters:
        `username` - User name to remove

    - #### changeUserPassword

          public void changeUserPassword​(java.lang.String username,
                                         java.lang.String password)

      Change user credentials.
      Parameters:
        `username` - The user name
        `password` - The new credentials

    - #### addUserRole

          public void addUserRole​(java.lang.String username,
                                  java.lang.String rolename)

      Add specified role to the user.
      Parameters:
        `username` - The user name
        `rolename` - The role name

    - #### removeUserRole

          public void removeUserRole​(java.lang.String username,
                                     java.lang.String rolename)

      Remove specified role from the user.
      Parameters:
        `username` - The user name
        `rolename` - The role name

    - #### getUserRoles

          public java.lang.String[] getUserRoles​(java.lang.String username)

      Get roles for a user.
      Parameters:
        `username` - The user name
      Returns:
        Array of role names

    - #### addUserGroup

          public void addUserGroup​(java.lang.String username,
                                   java.lang.String groupname)

      Add group to user.
      Parameters:
        `username` - The user name
        `groupname` - The group name

    - #### removeUserGroup

          public void removeUserGroup​(java.lang.String username,
                                      java.lang.String groupname)

      Remove group from user.
      Parameters:
        `username` - The user name
        `groupname` - The group name

    - #### getUserGroups

          public java.lang.String[] getUserGroups​(java.lang.String username)

      Get groups for a user.
      Parameters:
        `username` - The user name
      Returns:
        Array of group names

    - #### addGroupRole

          public void addGroupRole​(java.lang.String groupname,
                                   java.lang.String rolename)

      Add role to a group.
      Parameters:
        `groupname` - The group name
        `rolename` - The role name

    - #### removeGroupRole

          public void removeGroupRole​(java.lang.String groupname,
                                      java.lang.String rolename)

      Remove role from a group.
      Parameters:
        `groupname` - The group name
        `rolename` - The role name

    - #### getGroupRoles

          public java.lang.String[] getGroupRoles​(java.lang.String groupname)

      Get roles for a group.
      Parameters:
        `groupname` - The group name
      Returns:
        Array of role names