Class Admin

java.lang.Object
com.goldenleaf.shop.model.User
com.goldenleaf.shop.model.Admin

@Entity public class Admin extends User
Entity representing an administrative user of the online shop system.

Extends the base User entity and adds admin-specific attributes: a secret recovery word and a flag indicating super administrator privileges.

Super administrators have elevated rights such as managing other admins, accessing audit logs, and modifying global system settings.

Since:
1.0
See Also:
  • Constructor Details

    • Admin

      public Admin()
      Default constructor required by JPA. Creates a regular (non-super) admin.
    • Admin

      public Admin(String login, String passwordHash, String name, LocalDate lastActivity, String secretWord, boolean isSuperAdmin)
      Full constructor for creating a fully initialized admin account.
      Parameters:
      login - admin login/username
      passwordHash - securely hashed password
      name - full name of the administrator
      lastActivity - date of last activity
      secretWord - secret recovery phrase (can be null only during initialization)
      isSuperAdmin - true if this is a super administrator
  • Method Details

    • getSecretWord

      public String getSecretWord()
      Returns the secret recovery word.

      Security: This is sensitive data. Do not log or expose.

      Returns:
      the secret word (never null after object construction)
    • setSecretWord

      public void setSecretWord(String secretWord)
      Updates the secret word.

      Null values are ignored to prevent accidental clearing of the secret word.

      Parameters:
      secretWord - new secret word (must not be null)
    • getSuperAdmin

      public boolean getSuperAdmin()
      Checks whether this admin has super administrator privileges.
      Returns:
      true if this is a super admin, false otherwise
    • setSuperAdmin

      public void setSuperAdmin(boolean isSuperAdmin)
      Grants or revokes super administrator status.
      Parameters:
      isSuperAdmin - true to promote admin to super admin