|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openwms.core.domain.AbstractEntity
org.openwms.core.domain.system.usermanagement.User
public class User
An User represents a human user of the system. Typically an User is assigned
to one or more Role
s to define security constraints. Users can
have their own configuration settings in form of UserPreference
s
and certain user details, encapsulated in an UserDetails
object
that tend to be extended by projects.
UserDetails
,
UserPreference
,
UserPassword
,
Role
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.openwms.core.domain.AbstractEntity |
---|
AbstractEntity.AbstractEntityListener |
Field Summary | |
---|---|
static String |
NQ_FIND_ALL
Query to find all User s. |
static String |
NQ_FIND_ALL_ORDERED
Query to find all User s sorted by userName. |
static String |
NQ_FIND_BY_USERNAME
Query to find one User by his userName. |
static String |
NQ_FIND_BY_USERNAME_PASSWORD
Query to find one User by his userName and
password. |
static short |
NUMBER_STORED_PASSWORDS
The number of passwords to be stored in the password history. |
Fields inherited from class org.openwms.core.domain.AbstractEntity |
---|
FIND_ALL, FIND_BY_ID |
Constructor Summary | |
---|---|
protected |
User()
Accessed by persistence provider. |
|
User(String username)
Create a new User with an username. |
protected |
User(String username,
String password)
Create a new User with an username. |
Method Summary | |
---|---|
boolean |
addRole(Role role)
Add a new Role to the list of Role s. |
void |
changePassword(String password)
Checks if the new password is a valid and change the password of this User . |
boolean |
equals(Object obj)
Compare the uid property field. |
Date |
getExpirationDate()
Return the date when the account expires. |
String |
getFullname()
Return the fullname of the User . |
List<SecurityObject> |
getGrants()
Flatten Role s and Grant s and return an unmodifiable list
of all Grant s assigned to this User . |
Long |
getId()
Return the technical key value. |
Date |
getLastPasswordChange()
Return the date when the password has changed recently. |
String |
getPassword()
Returns the current password of the User . |
List<UserPassword> |
getPasswords()
Return a list of recently used passwords. |
Set<UserPreference> |
getPreferences()
Get all UserPreference s of this User . |
List<Role> |
getRoles()
Returns a list of granted Role s. |
UserDetails |
getUserDetails()
Return the details of the User . |
String |
getUsername()
Return the unique username of the User . |
long |
getVersion()
Return the value of the optimistic locking field. |
int |
hashCode()
Use the uid to calculate the hashCode. |
boolean |
hasPasswordChanged()
Checks whether the password is going to be changed from the application side. |
boolean |
isEnabled()
Determines whether the User is enabled or not. |
boolean |
isExternalUser()
Is the User authenticated by an external system? |
boolean |
isLocked()
Check if the User is locked. |
boolean |
isNew()
Check whether the instance is a transient or persisted one. |
protected boolean |
isPasswordValid(String pwd)
Check whether the new password is in the history of former passwords. |
void |
onLoad()
After load, the saved password is copied to the transient one. |
void |
setEnabled(boolean enabled)
Enable or disable the User . |
void |
setExpirationDate(Date expirationDate)
Change the date when the account expires. |
void |
setExternalUser(boolean externalUser)
Change the authentication method of the User . |
void |
setFullname(String fullname)
Change the fullname of the User . |
void |
setLocked(boolean locked)
Lock the User . |
void |
setPassword(String password)
Set the password that shall be stored as new password. |
void |
setPreferences(Set<UserPreference> preferences)
Set all UserPreference s of the User . |
void |
setRoles(List<Role> roles)
Set the Role s of this User . |
void |
setUserDetails(UserDetails userDetails)
Assign some details to the User . |
protected void |
setUsername(String username)
Change the username of the User . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NQ_FIND_ALL
User
s. Name is "User.findAll" .
public static final String NQ_FIND_ALL_ORDERED
User
s sorted by userName. Name is "User.findAllOrdered"
.
public static final String NQ_FIND_BY_USERNAME
User
by his userName. User
to search for.
public static final String NQ_FIND_BY_USERNAME_PASSWORD
User
by his userName and
password. User
to search for.User
to search for.
public static final short NUMBER_STORED_PASSWORDS
User
changes the password, the old password is stored in a
Collection. Default: 3 .
Constructor Detail |
---|
protected User()
public User(String username)
User
with an username.
username
- The unique name of the user
IllegalArgumentException
- when username is null
or emptyprotected User(String username, String password)
User
with an username.
username
- The unique name of the userpassword
- The password of the user
IllegalArgumentException
- when username or password is null
or emptyMethod Detail |
---|
public Long getId()
getId
in interface DomainObject<Long>
public boolean isNew()
isNew
in interface DomainObject<Long>
true
if transient (not persisted before), otherwise
false
public void onLoad()
public String getUsername()
User
.
protected void setUsername(String username)
User
.
username
- The new username to setpublic boolean isExternalUser()
User
authenticated by an external system?
true
if so, otherwise false
public void setExternalUser(boolean externalUser)
User
.
externalUser
- true
if the User
was authenticated
by an external system, otherwise false
.public Date getLastPasswordChange()
public boolean isLocked()
User
is locked.
true
if locked, otherwise false
public void setLocked(boolean locked)
User
.
locked
- true
to lock the User
,
false
to unlockpublic String getPassword()
User
.
public void setPassword(String password)
password
- The password to change topublic void changePassword(String password) throws InvalidPasswordException
User
.
password
- The new password of this User
InvalidPasswordException
- in case changing the password is not allowed or the new
password is not validpublic boolean hasPasswordChanged()
true
when the password
is different to
the saved one, otherwise false
protected boolean isPasswordValid(String pwd)
pwd
- The password to verify
true
if the password is valid, otherwise
false
public boolean isEnabled()
User
is enabled or not.
true
if the User
is enabled, otherwise
false
public void setEnabled(boolean enabled)
User
.
enabled
- true
when enabled, otherwise false
public Date getExpirationDate()
public void setExpirationDate(Date expirationDate)
expirationDate
- The new expiration date to setpublic List<Role> getRoles()
Role
s.
Role
spublic List<SecurityObject> getGrants()
Role
s and Grant
s and return an unmodifiable list
of all Grant
s assigned to this User
.
Grant
spublic boolean addRole(Role role)
Role
to the list of Role
s.
role
- The new Role
to add
Collection.add(Object)
public void setRoles(List<Role> roles)
Role
s of this User
. Existing Role
s
will be overridden.
roles
- The new list of Role
spublic String getFullname()
User
.
public void setFullname(String fullname)
User
.
fullname
- The new fullname to setpublic List<UserPassword> getPasswords()
public UserDetails getUserDetails()
User
.
public void setUserDetails(UserDetails userDetails)
User
.
userDetails
- The userDetails to setpublic Set<UserPreference> getPreferences()
UserPreference
s of this User
.
UserPreference
spublic void setPreferences(Set<UserPreference> preferences)
UserPreference
s of the User
. Already
existing UserPreference
s will be overridden.
preferences
- A set of UserPreference
s to setpublic long getVersion()
getVersion
in interface DomainObject<Long>
public int hashCode()
hashCode
in class AbstractEntity
Object.hashCode()
public boolean equals(Object obj)
equals
in class AbstractEntity
Object.equals(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |