de.esprit.netsuite.server.auth

## Class AbstractUserManager<S extends ServerContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<S>
    - - de.esprit.netsuite.server.AbstractServerObject<S>
      - - de.esprit.netsuite.server.AbstractInitializableServerObject<S>
        - - de.esprit.netsuite.server.auth.AbstractUserManager<S>

- All Implemented Interfaces:
    ApplicationObject<S>, Initializable, SimpleLogSupport, Clearable, Dumpable, UserAuthenticator, UserManager<S>, PermissionControlled, ServerObject<S>
  Direct Known Subclasses:
    DBUserManager, DefaultUserManager

      public abstract class AbstractUserManager<S extends ServerContext>
      extends AbstractInitializableServerObject<S>
      implements UserManager<S>, Clearable

  This class manages an internal cache of User objects and provides a default implementation for the UserManager methods
  Author:
    Rainer Buesch

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PermissionDefinition` | `permissionDef`

    - ### Fields inherited from interface de.esprit.netsuite.server.auth.UserManager

      `DEFAULT_ADMIN_USERNAME, DEFAULT_PASSWORD_ADMIN, DEFAULT_PASSWORD_ESPRIT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractUserManager(S serverCtx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `changePassword(SessionId sessionId, java.lang.String userName, java.lang.String oldPasswordDigest, java.lang.String newPasswordDigest)` Verifies the old password and sets the new one.
    `protected void` | `checkIsUpdateAllowedOnUser(User user)`
    `void` | `clear()` Clears the content
    `void` | `deleteUser(SessionId sessionId, User user)`
    `User` | `findUserById(int uid)`
    `User` | `findUserByName(java.lang.String userName)`
    `User` | `findUserForLogin(LoginData data)` Verifies user login data and returns a UserId on success.
    `PermissionDefinition` | `getPermissionDefinition()` Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
    `protected java.io.File` | `getUserConfigFile()`
    `int` | `getUserCount()`
    `UserId[]` | `getUserIds()`
    `protected java.util.List<User>` | `getUserList()`
    `User[]` | `getUsers(SessionId sessionId)`
    `void` | `init()` Loads all users from the underlying persistent store
    `User` | `insertUser(SessionId sessionId, User user)` Note that the underlying `UserManager` implementation will return a server specific user subclass.
    `boolean` | `isEmptyPasswordAllowed()` Returns the flag as configured in ServerStartup
    `protected int` | `nextUserId()` Takes the biggest existing uidKey + 1
    `protected void` | `performAfterUpdateUser(SessionId sessionId, User user)` May do something after a User update (required i.e. for permission management)
    `protected abstract void` | `performChangePassword(SessionId sessionId, User user, java.lang.String oldPassword, java.lang.String newPassword)`
    `protected abstract void` | `performDeleteUser(SessionId sessionId, User user)`
    `protected abstract User` | `performInsertUser(SessionId sessionId, User user, java.util.List<User> userList)`
    `protected abstract void` | `performResetPassword(SessionId sessionId, User user, boolean isClear)`
    `protected abstract void` | `performUpdateUser(SessionId sessionId, User user)`
    `protected abstract void` | `read(java.util.List<User> userList)`
    `void` | `resetPassword(SessionId sessionId, User user, boolean isClear)` Resets the password for the given User to the system default user password as configured in the srv_params.cfg file.
    `void` | `setDefaultUserPassword(SessionId sessionId, java.lang.String encryptedPassword)` Sets the system default password for new users
    `void` | `updateUser(SessionId sessionId, User user)`

    - ### Methods inherited from class de.esprit.netsuite.server.AbstractInitializableServerObject

      `checkInitialized, isInitialized, setInitialized, toString`

    - ### Methods inherited from class de.esprit.netsuite.server.AbstractServerObject

      `checkPermission, getServerConfig, getServerContext, getStatisticManager`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### permissionDef

          public static final PermissionDefinition permissionDef

  - ### Constructor Detail

    - #### AbstractUserManager

          public AbstractUserManager(S serverCtx)

  - ### Method Detail

    - #### getPermissionDefinition

          public PermissionDefinition getPermissionDefinition()

      Description copied from interface: `PermissionControlled`
      Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
      Specified by:
        `getPermissionDefinition` in interface `PermissionControlled`

    - #### init

          public final void init()
                          throws java.lang.Exception

      Description copied from interface: `UserManager`
      Loads all users from the underlying persistent store
      Specified by:
        `init` in interface `Initializable`
      Specified by:
        `init` in interface `UserManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### clear

          public final void clear()

      Description copied from interface: `Clearable`
      Clears the content
      Specified by:
        `clear` in interface `Clearable`

    - #### getUserCount

          public final int getUserCount()

      Specified by:
        `getUserCount` in interface `UserManager<S extends ServerContext>`

    - #### getUsers

          public final User[] getUsers(SessionId sessionId)
                                throws PermissionException

      Specified by:
        `getUsers` in interface `UserManager<S extends ServerContext>`
      Throws:
        `PermissionException`

    - #### getUserIds

          public final UserId[] getUserIds()

      Specified by:
        `getUserIds` in interface `UserManager<S extends ServerContext>`

    - #### setDefaultUserPassword

          public final void setDefaultUserPassword(SessionId sessionId,
                                    java.lang.String encryptedPassword)
                                            throws java.lang.Exception

      Description copied from interface: `UserAuthenticator`
      Sets the system default password for new users
      Specified by:
        `setDefaultUserPassword` in interface `UserAuthenticator`
      Throws:
        `java.lang.Exception`

    - #### resetPassword

          public final void resetPassword(SessionId sessionId,
                           User user,
                           boolean isClear)
                                   throws java.lang.Exception

      Description copied from interface: `UserAuthenticator`
      Resets the password for the given User to the system default user password as configured in the srv_params.cfg file.
      Specified by:
        `resetPassword` in interface `UserAuthenticator`
      Throws:
        `java.lang.Exception`

    - #### changePassword

          public final void changePassword(SessionId sessionId,
                            java.lang.String userName,
                            java.lang.String oldPasswordDigest,
                            java.lang.String newPasswordDigest)
                                    throws java.lang.Exception

      Description copied from interface: `UserAuthenticator`
      Verifies the old password and sets the new one. An Exception is thrown if the old password does not match the current password or if the new password does not match your password rules. Note that the user password is being removed when no new password is given.
      Specified by:
        `changePassword` in interface `UserAuthenticator`
      Throws:
        `java.lang.Exception`

    - #### insertUser

          public final User insertUser(SessionId sessionId,
                        User user)
                                throws java.lang.Exception

      Description copied from interface: `UserManager`
      Note that the underlying `UserManager` implementation will return a server specific user subclass.
      Specified by:
        `insertUser` in interface `UserManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### updateUser

          public final void updateUser(SessionId sessionId,
                        User user)
                                throws java.lang.Exception

      Specified by:
        `updateUser` in interface `UserManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### deleteUser

          public final void deleteUser(SessionId sessionId,
                        User user)
                                throws java.lang.Exception

      Specified by:
        `deleteUser` in interface `UserManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### findUserForLogin

          public final User findUserForLogin(LoginData data)
                                      throws InvalidLoginException

      Description copied from interface: `UserAuthenticator`
      Verifies user login data and returns a UserId on success. Must throw an Exception if the user does not exist.
      Specified by:
        `findUserForLogin` in interface `UserAuthenticator`
      Throws:
        `InvalidLoginException`

    - #### findUserByName

          public final User findUserByName(java.lang.String userName)

      Specified by:
        `findUserByName` in interface `UserManager<S extends ServerContext>`

    - #### findUserById

          public final User findUserById(int uid)

      Specified by:
        `findUserById` in interface `UserManager<S extends ServerContext>`

    - #### isEmptyPasswordAllowed

          public final boolean isEmptyPasswordAllowed()

      Returns the flag as configured in ServerStartup
      Specified by:
        `isEmptyPasswordAllowed` in interface `UserManager<S extends ServerContext>`

    - #### nextUserId

          protected int nextUserId()

      Takes the biggest existing uidKey + 1

    - #### getUserConfigFile

          protected java.io.File getUserConfigFile()

    - #### getUserList

          protected final java.util.List<User> getUserList()

    - #### checkIsUpdateAllowedOnUser

          protected void checkIsUpdateAllowedOnUser(User user)
                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### read

          protected abstract void read(java.util.List<User> userList)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performChangePassword

          protected abstract void performChangePassword(SessionId sessionId,
                                   User user,
                                   java.lang.String oldPassword,
                                   java.lang.String newPassword)
                                                 throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performResetPassword

          protected abstract void performResetPassword(SessionId sessionId,
                                  User user,
                                  boolean isClear)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performInsertUser

          protected abstract User performInsertUser(SessionId sessionId,
                               User user,
                               java.util.List<User> userList)
                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performDeleteUser

          protected abstract void performDeleteUser(SessionId sessionId,
                               User user)
                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performUpdateUser

          protected abstract void performUpdateUser(SessionId sessionId,
                               User user)
                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### performAfterUpdateUser

          protected void performAfterUpdateUser(SessionId sessionId,
                                    User user)

      May do something after a User update (required i.e. for permission management)

Copyright © 2014 EsprIT-Systems. All Rights Reserved.