Class JKUserWebControllers

All Implemented Interfaces:
Serializable

@Named("usersController") @ViewScoped public class JKUserWebControllers extends JKWebControllerWithOrmSupport<User>
This class is responsible for managing user-related operations in a web application.

It is used for tasks such as changing passwords, checking user roles, and handling user data.

This class extends the JKWebControllerWithOrmSupport class for web functionality and ORM support.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
See Also:
  • Constructor Details

    • JKUserWebControllers

      public JKUserWebControllers()
  • Method Details

    • getMessage

      public String getMessage()
      This method get the error message related to authentication.
      Returns:
      the error message or null if no error occurred.
    • getUser

      public User getUser()
      This method gets the currently logged-in user.
      Returns:
      the User object representing the logged-in user or null if not logged in.
    • getService

      protected SecurityService getService()
      This method get the SecurityService instance.
      Returns:
      the SecurityService instance for managing security-related tasks.
    • getCurrentPassword

      public String getCurrentPassword()
      This method gets the current password.
      Returns:
      the current password.
    • setCurrentPassword

      public void setCurrentPassword(String currentPassword)
      This method sets the current password.
      Parameters:
      currentPassword - Specifies the new current password.
    • getNewPassword

      public String getNewPassword()
      This method gets the new password.
      Returns:
      the new password.
    • setNewPassword

      public void setNewPassword(String newPassword)
      This method sets the new password.
      Parameters:
      newPassword - Specifies the new password.
    • changePassword

      public String changePassword()
      This method change the user's password.
      Returns:
      the string dashboard if the password changed, or null if it couldn't be changed.
    • isAdmin

      public boolean isAdmin()
      This method check if the current user is an administrator.
      Returns:
      true, if the current user is an administrator, false otherwise.
    • beforeInsert

      protected void beforeInsert()
      This method is a callback method executed before inserting a new user.
      Overrides:
      beforeInsert in class JKWebControllerWithOrmSupport<User>
    • beforeUpdate

      protected void beforeUpdate()
      This method is a callback method executed before updating an existing user.
      Overrides:
      beforeUpdate in class JKWebControllerWithOrmSupport<User>
    • reset

      public String reset()
      This method reset the new password field.
      Overrides:
      reset in class JKWebControllerWithOrmSupport<User>
      Returns:
      null.