Package com.logicaldoc.core.security.user

# Class User

java.lang.Object
com.logicaldoc.core.PersistentObject
com.logicaldoc.core.security.user.User

All Implemented Interfaces:
  `Serializable`

@Entity public class User extends PersistentObject implements Serializable
This class represents a user. A user can be member of any number of groups, but it is always member of a special group named '_user_'+id. When a new user is created this special group of type 'user' is also created.

Version:
  1.0
Author:
  Michael Scholz, Marco Meschieri
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final long`
`USERID_ADMIN`
`static final long`
`USERID_SYSTEM`

### Fields inherited from class com.logicaldoc.core.PersistentObject

`DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id`

## Constructor Summary

Constructors
Constructor
Description
`User()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addGroup(Group group)`
`void`
`clearPassword()`
Used to remove credentials informations from as security measure in case some malicious code could get it from this bean
`boolean`
`equals(Object obj)`
`String`
`getAvatar()`
`String`
`getBuilding()`
`String`
`getCertDN()`
`Date`
`getCertExpire()`
`String`
`getCity()`
`String`
`getCompany()`
`String`
`getCountry()`
`String`
`getDateFormat()`
`String`
`getDateFormatLong()`
`String`
`getDateFormatShort()`
`String`
`getDecodedPassword()`
`Long`
`getDefaultWorkspace()`
`String`
`getDepartment()`
`String`
`getDocsGrid()`
`String`
`getEmail()`
`String`
`getEmail2()`
`String`
`getEmailSignature()`
`String`
`getEmailSignature2()`
`Date`
`getExpire()`
`String`
`getFirstName()`
`String`
`getFullName()`
`Set<Group>`
`getGroups()`
`String`
`getHitsGrid()`
`String`
`getImpersonator()`
`Set<String>`
`getImpersonators()`
`String`
`getInitials()`
`String`
`getIpBlackList()`
`String`
`getIpWhiteList()`
`String`
`getKey()`
`String`
`getLanguage()`
`Date`
`getLastEnabled()`
`Date`
`getLastLogin()`
`Locale`
`getLocale()`
`Integer`
`getMaxInactivity()`
`String`
`getName()`
`String`
`getOrganizationalUnit()`
`String`
`getPassword()`
`Date`
`getPasswordChanged()`
When the password was modified
`String`
`getPostalcode()`
`long`
`getQuota()`
`String`
`getRepass()`
`String`
`getSearchPref()`
`String`
`getSecondFactor()`
`long`
`getSessionsQuota()`
`UserSource`
`getSource()`
The source from which the user has been created
`String`
`getState()`
`String`
`getStreet()`
`String`
`getTelephone()`
`String`
`getTelephone2()`
`String`
`getTimeZone()`
`UserType`
`getType()`
`Group`
`getUserGroup()`
Retrieves this user's group
`String`
`getUserGroupName()`
The name of the group associated to this user, that is '_user_'+id
`Set<UserGroup>`
`getUserGroups()`
`String`
`getUsername()`
`Integer`
`getWelcomeScreen()`
`Set<WorkingTime>`
`getWorkingTimes()`
`int`
`hashCode()`
`boolean`
`isAdmin()`
Checks if the user is member of the admin group
`boolean`
`isEnabled()`
`boolean`
`isEnforceWorkingTime()`
`boolean`
`isEvalFormEnabled()`
`boolean`
`isExpired()`
Checks if the user is expired now
`boolean`
`isInWorkingTime()`
Checks if the user falls in his working time
`boolean`
`isLegals()`
`boolean`
`isMemberOf(String groupName)`
`boolean`
`isPasswordExpired()`
`boolean`
`isPasswordExpires()`
If the password expires or not
`boolean`
`isReadonly()`
`void`
`removeGroup(long groupId)`
`void`
`removeGroupMemberships(String source)`
Removes the user from All groups except it's user's own group.
`void`
`setAvatar(String avatar)`
`void`
`setBuilding(String building)`
`void`
`setCertDN(String certDN)`
`void`
`setCertExpire(Date certExpire)`
`void`
`setCity(String ct)`
`void`
`setCompany(String company)`
`void`
`setCountry(String cnt)`
`void`
`setDateFormat(String dateFormat)`
`void`
`setDateFormatLong(String dateFormatLong)`
`void`
`setDateFormatShort(String dateFormatShort)`
`void`
`setDecodedPassword(String pwd)`
Sets the password and encode it
`void`
`setDefaultWorkspace(Long defaultWorkspace)`
`void`
`setDepartment(String department)`
`void`
`setDocsGrid(String docsGrid)`
`void`
`setEmail(String mail)`
`void`
`setEmail2(String email2)`
`void`
`setEmailSignature(String emailSignature)`
`void`
`setEmailSignature2(String emailSignature2)`
`void`
`setEnabled(boolean enabled)`
`void`
`setEnforceWorkingTime(boolean enforceWorkingTime)`
`void`
`setEvalFormEnabled(boolean evalFormEnabled)`
`void`
`setExpire(Date expire)`
`void`
`setFirstName(String firstName)`
`void`
`setGroups(Set<Group> groups)`
`void`
`setHitsGrid(String hitsGrid)`
`void`
`setImpersonator(String impersonator)`
`void`
`setImpersonators(Set<String> impersonators)`
`void`
`setIpBlackList(String ipBlackList)`
`void`
`setIpWhiteList(String ipWhiteList)`
`void`
`setKey(String key)`
`void`
`setLanguage(String lang)`
`void`
`setLastEnabled(Date lastEnabled)`
`void`
`setLastLogin(Date lastLogin)`
`void`
`setLegals(boolean legals)`
`void`
`setLocale(Locale locale)`
`void`
`setMaxInactivity(Integer maxInactivity)`
`void`
`setName(String name)`
`void`
`setOrganizationalUnit(String organizationalUnit)`
`void`
`setPassword(String pwd)`
`void`
`setPasswordChanged(Date passwordChanged)`
`void`
`setPasswordExpired(boolean passwordExpired)`
`void`
`setPasswordExpires(boolean passwordExpires)`
`void`
`setPostalcode(String pc)`
`void`
`setQuota(long quota)`
`void`
`setRepass(String repass)`
`void`
`setSearchPref(String searchPref)`
`void`
`setSecondFactor(String secondFactor)`
`void`
`setSessionsQuota(long sessionsQuota)`
`void`
`setSource(int source)`
`void`
`setSource(UserSource source)`
`void`
`setState(String state)`
`void`
`setStreet(String str)`
`void`
`setTelephone(String phone)`
`void`
`setTelephone2(String telephone2)`
`void`
`setTimeZone(String timeZone)`
`void`
`setType(int type)`
`void`
`setType(UserType type)`
`void`
`setUserGroups(Set<UserGroup> userGroups)`
`void`
`setUsername(String uname)`
`void`
`setWelcomeScreen(Integer welcomeScreen)`
`void`
`setWorkingTimes(Set<WorkingTime> workingTimes)`
`String`
`toString()`

### Methods inherited from class com.logicaldoc.core.PersistentObject

`getCreation, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, setCreation, setDeleted, setId, setLastModified, setRecordVersion, setTenantId`

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

`getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### USERID_ADMIN

public static final long USERID_ADMIN

See Also:
  - Constant Field Values

### USERID_SYSTEM

public static final long USERID_SYSTEM

See Also:
  - Constant Field Values

## Constructor Details

### User

public User()

## Method Details

### getCompany

public String getCompany()

### setCompany

public void setCompany(String company)

### getType

public UserType getType()

### setType

public void setType(UserType type)

### setType

public void setType(int type)

### getRepass

public String getRepass()

### setRepass

public void setRepass(String repass)

### getUsername

public String getUsername()

### getPassword

public String getPassword()

### getName

public String getName()

### getFullName

public String getFullName()

### getInitials

public String getInitials()

### getFirstName

public String getFirstName()

### getStreet

public String getStreet()

### getPostalcode

public String getPostalcode()

### getCity

public String getCity()

### getCountry

public String getCountry()

### getLanguage

public String getLanguage()

### getEmail

public String getEmail()

### getTelephone

public String getTelephone()

### isAdmin

public boolean isAdmin()
Checks if the user is member of the admin group

Returns:
  true only if the user belongs to the admin group

### isMemberOf

public boolean isMemberOf(String groupName)

### addGroup

public void addGroup(Group group)

### removeGroup

public void removeGroup(long groupId)

### removeGroupMemberships

public void removeGroupMemberships(String source)
Removes the user from All groups except it's user's own group. You can restrict the deletion to a specified source

Parameters:
  `source` - the source

### setUsername

public void setUsername(String uname)

### setPassword

public void setPassword(String pwd)

### setDecodedPassword

public void setDecodedPassword(String pwd) throws NoSuchAlgorithmException
Sets the password and encode it

Parameters:
  `pwd` - The password in readable format
Throws:
  `NoSuchAlgorithmException` - Crypting error

### setName

public void setName(String name)

### setFirstName

public void setFirstName(String firstName)

### setStreet

public void setStreet(String str)

### setPostalcode

public void setPostalcode(String pc)

### setCity

public void setCity(String ct)

### setCountry

public void setCountry(String cnt)

### setLanguage

public void setLanguage(String lang)

### setEmail

public void setEmail(String mail)

### setTelephone

public void setTelephone(String phone)

### getSessionsQuota

public long getSessionsQuota()

### setSessionsQuota

public void setSessionsQuota(long sessionsQuota)

### toString

public String toString()

Overrides:
  `toString` in class `PersistentObject`

### getGroups

public Set<Group> getGroups()

### setGroups

public void setGroups(Set<Group> groups)

### getImpersonators

public Set<String> getImpersonators()

### setImpersonators

public void setImpersonators(Set<String> impersonators)

### getImpersonator

public String getImpersonator()

### setImpersonator

public void setImpersonator(String impersonator)

### getUserGroupName

public String getUserGroupName()
The name of the group associated to this user, that is '_user_'+id

Returns:
  name of the group that represents this user

### getUserGroup

public Group getUserGroup() throws PersistenceException
Retrieves this user's group

Returns:
  the group
Throws:
  `PersistenceException` - Error in the data layer

### isEnabled

public boolean isEnabled()

### setEnabled

public void setEnabled(boolean enabled)

### getState

public String getState()

### setState

public void setState(String state)

### getTelephone2

public String getTelephone2()

### setTelephone2

public void setTelephone2(String telephone2)

### getLocale

public Locale getLocale()

### setLocale

public void setLocale(Locale locale)

### getPasswordChanged

public Date getPasswordChanged()
When the password was modified

Returns:
  when the password has been altered

### setPasswordChanged

public void setPasswordChanged(Date passwordChanged)

### isPasswordExpires

public boolean isPasswordExpires()
If the password expires or not

Returns:
  true if the password expires, false otherwise

### setPasswordExpires

public void setPasswordExpires(boolean passwordExpires)

### getSource

public UserSource getSource()
The source from which the user has been created

Returns:
  the source
See Also:
  - `UserSource`

### setSource

public void setSource(UserSource source)

### setSource

public void setSource(int source)

### getQuota

public long getQuota()

### setQuota

public void setQuota(long quota)

### getWelcomeScreen

public Integer getWelcomeScreen()

### setWelcomeScreen

public void setWelcomeScreen(Integer welcomeScreen)

### getIpWhiteList

public String getIpWhiteList()

### setIpWhiteList

public void setIpWhiteList(String ipWhiteList)

### getIpBlackList

public String getIpBlackList()

### setIpBlackList

public void setIpBlackList(String ipBlackList)

### getDecodedPassword

public String getDecodedPassword()

### getEmailSignature

public String getEmailSignature()

### setEmailSignature

public void setEmailSignature(String emailSignature)

### clearPassword

public void clearPassword()
Used to remove credentials informations from as security measure in case some malicious code could get it from this bean

### getDefaultWorkspace

public Long getDefaultWorkspace()

### setDefaultWorkspace

public void setDefaultWorkspace(Long defaultWorkspace)

### getEmail2

public String getEmail2()

### setEmail2

public void setEmail2(String email2)

### getEmailSignature2

public String getEmailSignature2()

### setEmailSignature2

public void setEmailSignature2(String emailSignature2)

### getUserGroups

public Set<UserGroup> getUserGroups()

### setUserGroups

public void setUserGroups(Set<UserGroup> userGroups)

### getCertExpire

public Date getCertExpire()

### setCertExpire

public void setCertExpire(Date certExpire)

### getCertDN

public String getCertDN()

### setCertDN

public void setCertDN(String certDN)

### getSecondFactor

public String getSecondFactor()

### setSecondFactor

public void setSecondFactor(String secondFactor)

### getKey

public String getKey()

### setKey

public void setKey(String key)

### isReadonly

public boolean isReadonly()

### getDocsGrid

public String getDocsGrid()

### setDocsGrid

public void setDocsGrid(String docsGrid)

### getHitsGrid

public String getHitsGrid()

### setHitsGrid

public void setHitsGrid(String hitsGrid)

### getAvatar

public String getAvatar()

### setAvatar

public void setAvatar(String avatar)

### getDateFormat

public String getDateFormat()

### setDateFormat

public void setDateFormat(String dateFormat)

### getDateFormatShort

public String getDateFormatShort()

### setDateFormatShort

public void setDateFormatShort(String dateFormatShort)

### getDateFormatLong

public String getDateFormatLong()

### setDateFormatLong

public void setDateFormatLong(String dateFormatLong)

### getSearchPref

public String getSearchPref()

### setSearchPref

public void setSearchPref(String searchPref)

### getExpire

public Date getExpire()

### setExpire

public void setExpire(Date expire)

### getLastEnabled

public Date getLastEnabled()

### setLastEnabled

public void setLastEnabled(Date lastEnabled)

### isExpired

public boolean isExpired()
Checks if the user is expired now

Returns:
  true only if an expiration date has been specified and the current date is after it

### isInWorkingTime

public boolean isInWorkingTime()
Checks if the user falls in his working time

Returns:
  true only if at least a working time slot matches the current time

### getWorkingTimes

public Set<WorkingTime> getWorkingTimes()

### setWorkingTimes

public void setWorkingTimes(Set<WorkingTime> workingTimes)

### getMaxInactivity

public Integer getMaxInactivity()

### setMaxInactivity

public void setMaxInactivity(Integer maxInactivity)

### getTimeZone

public String getTimeZone()

### setTimeZone

public void setTimeZone(String timeZone)

### getLastLogin

public Date getLastLogin()

### setLastLogin

public void setLastLogin(Date lastLogin)

### getDepartment

public String getDepartment()

### setDepartment

public void setDepartment(String department)

### getOrganizationalUnit

public String getOrganizationalUnit()

### setOrganizationalUnit

public void setOrganizationalUnit(String organizationalUnit)

### getBuilding

public String getBuilding()

### setBuilding

public void setBuilding(String building)

### isLegals

public boolean isLegals()

### setLegals

public void setLegals(boolean legals)

### isPasswordExpired

public boolean isPasswordExpired()

### setPasswordExpired

public void setPasswordExpired(boolean passwordExpired)

### isEnforceWorkingTime

public boolean isEnforceWorkingTime()

### setEnforceWorkingTime

public void setEnforceWorkingTime(boolean enforceWorkingTime)

### isEvalFormEnabled

public boolean isEvalFormEnabled()

### setEvalFormEnabled

public void setEvalFormEnabled(boolean evalFormEnabled)

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `PersistentObject`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `PersistentObject`