Class Admin
java.lang.Object
com.goldenleaf.shop.model.User
com.goldenleaf.shop.model.Admin
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the secret recovery word.booleanChecks whether this admin has super administrator privileges.voidsetSecretWord(String secretWord) Updates the secret word.voidsetSuperAdmin(boolean isSuperAdmin) Grants or revokes super administrator status.Methods inherited from class com.goldenleaf.shop.model.User
getId, getLastActivity, getLogin, setLastActivity, setLogin, setPassword
-
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/usernamepasswordHash- securely hashed passwordname- full name of the administratorlastActivity- date of last activitysecretWord- secret recovery phrase (can be null only during initialization)isSuperAdmin-trueif this is a super administrator
-
-
Method Details
-
getSecretWord
Returns the secret recovery word.Security: This is sensitive data. Do not log or expose.
- Returns:
- the secret word (never
nullafter object construction)
-
setSecretWord
Updates the secret word.Null values are ignored to prevent accidental clearing of the secret word.
- Parameters:
secretWord- new secret word (must not benull)
-
getSuperAdmin
public boolean getSuperAdmin()Checks whether this admin has super administrator privileges.- Returns:
trueif this is a super admin,falseotherwise
-
setSuperAdmin
public void setSuperAdmin(boolean isSuperAdmin) Grants or revokes super administrator status.- Parameters:
isSuperAdmin-trueto promote admin to super admin
-