Class AdminUser
- java.lang.Object
-
- fr.paris.lutece.portal.business.user.AdminUser
-
- All Implemented Interfaces:
fr.paris.lutece.api.user.User,fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource,Serializable
- Direct Known Subclasses:
LuteceDefaultAdminUser
public class AdminUser extends Object implements Serializable, fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource, fr.paris.lutece.api.user.User
This Interface defines all methods required for an admin user implementation- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIVE_CODEstatic intANONYMIZED_CODEstatic intEXPIRED_CODEstatic intNOT_ACTIVE_CODEstatic StringRESOURCE_TYPEstatic StringUSER_REALMUSER REALM TYPE
-
Constructor Summary
Constructors Constructor Description AdminUser()ConstructorAdminUser(String stAccessCode, AdminAuthentication authenticationService)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddRoles(Map<String,RBACRole> roles)add user's rolesbooleancheckRight(String strRightCode)Verify user rights on a given functionalityStringgetAccessCode()booleangetAccessibilityMode()Return the accessibility modeTimestampgetAccountMaxValidDate()Get the expiration date of the user account.StringgetAuthenticationService()Returns the authentification service that had authentified the userStringgetAuthenticationType()Returns the authentification type that had authentified the userTimestampgetDateLastLogin()Get the last login date of the userstatic TimestampgetDefaultDateLastLogin()StringgetEmail()Returns the email of this user.StringgetFirstName()Returns the first name of this user.StringgetLastName()Returns the last name of this user.@NotNull LocalegetLocale()Get the user's LocaleTimestampgetPasswordMaxValidDate()Get the maximum valid date of the password of the userStringgetRealm()intgetRealStatus()Map<String,Right>getRights()Returns user's rightsMap<String,fr.paris.lutece.api.user.UserRole>getRoles()Deprecated.use getRBACRoles( )intgetStatus()intgetUserId()Return the user's id<X> XgetUserInfo(String strKey)Gets the user info for a given keyintgetUserLevel()Returns the user levelMap<String,fr.paris.lutece.api.user.UserRole>getUserRoles()List<String>getUserWorkgroups()StringgetWorkgroup()StringgetWorkgroupKey()booleanhasRights(int level)Check if current user has rights depending on levelstatic voidinit()InitbooleanisAdmin()Check if this user has admin rightsbooleanisInRole(String strRole)Check if this user has a given rolebooleanisParent(AdminUser user)Check if current user has rights over userbooleanisPasswordReset()Check if the password has been reinitializedbooleanisStatusActive()Tells whether the current user is active or notbooleanisStatusAnonymized()Tells whether the current user is anonymizedvoidsetAccessCode(String strAccessCode)voidsetAccessibilityMode(boolean bAccessibilityMode)Set the accessibility modevoidsetAccountMaxValidDate(Timestamp accountMaxValidDate)Set the expiration date of the user account.voidsetAuthenticationService(String strAuthenticationService)Defines the authentification service that had authentified the uservoidsetAuthenticationType(String strAuthenticationType)Defines the authentification type that had authentified the uservoidsetDateLastLogin(Timestamp dateLastLogin)Set the last login date of the uservoidsetEmail(String strEmail)Sets the email of the user to the specified string.voidsetFirstName(String strFirstName)Sets the first name of the user to the specified string.voidsetLastName(String strLastName)Sets the last name of the user to the specified string.voidsetLocale(Locale locale)Set the user LocalevoidsetPasswordMaxValidDate(Timestamp passwordMaxValidDate)Set the maximum valid date of the password of the uservoidsetPasswordReset(boolean bIsPasswordReset)Set pwd resetedvoidsetRights(Map<String,Right> rights)Defines user's rightsvoidsetRoles(Map<String,RBACRole> roles)Defines user's rolesvoidsetStatus(int nStatus)voidsetUserId(int nUserId)Sets the user's id<X> XsetUserInfo(String strKey, X info)Sets a user info for the given key.voidsetUserLevel(int nUserLevel)Defines the user levelvoidsetUserWorkgroups(List<String> workgroups)Defines user's workgroupsvoidsetWorkgroupKey(String strWorkgroupKey)voidupdateRight(Right rightToUpdate)Update user right
-
-
-
Field Detail
-
RESOURCE_TYPE
public static final String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
USER_REALM
public static final String USER_REALM
USER REALM TYPE- See Also:
- Constant Field Values
-
ACTIVE_CODE
public static final int ACTIVE_CODE
- See Also:
- Constant Field Values
-
NOT_ACTIVE_CODE
public static final int NOT_ACTIVE_CODE
- See Also:
- Constant Field Values
-
EXPIRED_CODE
public static final int EXPIRED_CODE
- See Also:
- Constant Field Values
-
ANONYMIZED_CODE
public static final int ANONYMIZED_CODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AdminUser
public AdminUser()
Constructor
-
AdminUser
public AdminUser(String stAccessCode, AdminAuthentication authenticationService)
Constructor- Parameters:
stAccessCode- The User NameauthenticationService- The PortalAuthentication object
-
-
Method Detail
-
init
public static void init()
Init
-
getLocale
@NotNull public @NotNull Locale getLocale()
Get the user's Locale- Returns:
- The user's locale
-
setLocale
public void setLocale(Locale locale)
Set the user Locale- Parameters:
locale- The locale
-
getUserId
public int getUserId()
Return the user's id- Returns:
- The user id
-
setUserId
public void setUserId(int nUserId)
Sets the user's id- Parameters:
nUserId- The User id
-
getStatus
public int getStatus()
- Returns:
- Returns the status. Only ACTIVE_CODE, NOT_ACTIVE_CODE or ANONYMIZED_CODE are returned. If the status in an other status, then its equivalent is returned
-
getRealStatus
public int getRealStatus()
- Returns:
- Returns the real status of the user.
-
setStatus
public void setStatus(int nStatus)
- Parameters:
nStatus- The _nStatus to set.
-
isStatusActive
public boolean isStatusActive()
Tells whether the current user is active or not- Returns:
- true if active, false otherwise
-
isStatusAnonymized
public boolean isStatusAnonymized()
Tells whether the current user is anonymized- Returns:
- true if anonymized, false otherwise
-
getLastName
public String getLastName()
Returns the last name of this user.- Specified by:
getLastNamein interfacefr.paris.lutece.api.user.User- Returns:
- the user last name
-
setLastName
public void setLastName(String strLastName)
Sets the last name of the user to the specified string.- Parameters:
strLastName- the new last name
-
getFirstName
public String getFirstName()
Returns the first name of this user.- Specified by:
getFirstNamein interfacefr.paris.lutece.api.user.User- Returns:
- the user first name
-
setFirstName
public void setFirstName(String strFirstName)
Sets the first name of the user to the specified string.- Parameters:
strFirstName- the new first name
-
getEmail
public String getEmail()
Returns the email of this user.- Specified by:
getEmailin interfacefr.paris.lutece.api.user.User- Returns:
- the user email
-
setEmail
public void setEmail(String strEmail)
Sets the email of the user to the specified string.- Parameters:
strEmail- the new email
-
getAccessCode
public String getAccessCode()
- Specified by:
getAccessCodein interfacefr.paris.lutece.api.user.User- Returns:
- Returns the _strAccessCode.
-
setAccessCode
public void setAccessCode(String strAccessCode)
- Parameters:
strAccessCode- The _strAccessCode to set.
-
getPasswordMaxValidDate
public Timestamp getPasswordMaxValidDate()
Get the maximum valid date of the password of the user- Returns:
- The maximum valid date of the password of the user
-
setPasswordMaxValidDate
public void setPasswordMaxValidDate(Timestamp passwordMaxValidDate)
Set the maximum valid date of the password of the user- Parameters:
passwordMaxValidDate- The new maximum valid date of the password of the user, or null if it doesn't have any.
-
getAccountMaxValidDate
public Timestamp getAccountMaxValidDate()
Get the expiration date of the user account.- Returns:
- The expiration date of the user account, or null if it doesn't have any.
-
setAccountMaxValidDate
public void setAccountMaxValidDate(Timestamp accountMaxValidDate)
Set the expiration date of the user account.- Parameters:
accountMaxValidDate- The new expiration date of the user account.
-
getRoles
@Deprecated public Map<String,fr.paris.lutece.api.user.UserRole> getRoles()
Deprecated.use getRBACRoles( )Returns user's roles- Returns:
- Returns user's roles
-
getUserRoles
public Map<String,fr.paris.lutece.api.user.UserRole> getUserRoles()
- Specified by:
getUserRolesin interfacefr.paris.lutece.api.user.User
-
addRoles
public void addRoles(Map<String,RBACRole> roles)
add user's roles- Parameters:
roles- The User roles
-
setRoles
public void setRoles(Map<String,RBACRole> roles)
Defines user's roles- Parameters:
roles- The User roles
-
getRights
public Map<String,Right> getRights()
Returns user's rights- Returns:
- Returns user's rights
-
checkRight
public boolean checkRight(String strRightCode)
Verify user rights on a given functionality- Parameters:
strRightCode- right code which corresponding to the functionality- Returns:
- true if user have this authorisation and false otherwise
-
setRights
public void setRights(Map<String,Right> rights)
Defines user's rights- Parameters:
rights- The User rights
-
updateRight
public void updateRight(Right rightToUpdate)
Update user right- Parameters:
rightToUpdate- to update in _rights for user
-
setAuthenticationService
public void setAuthenticationService(String strAuthenticationService)
Defines the authentification service that had authentified the user- Parameters:
strAuthenticationService- The authentification service
-
getAuthenticationService
public String getAuthenticationService()
Returns the authentification service that had authentified the user- Returns:
- the authentification service that had authentified the user
-
setAuthenticationType
public void setAuthenticationType(String strAuthenticationType)
Defines the authentification type that had authentified the user- Parameters:
strAuthenticationType- The authentification type
-
getAuthenticationType
public String getAuthenticationType()
Returns the authentification type that had authentified the user- Returns:
- the authentification type that had authentified the user
-
setUserLevel
public void setUserLevel(int nUserLevel)
Defines the user level- Parameters:
nUserLevel- the user level
-
getUserLevel
public int getUserLevel()
Returns the user level- Returns:
- the user level
-
isParent
public boolean isParent(AdminUser user)
Check if current user has rights over user- Parameters:
user- the user to check- Returns:
- true if current user has higher level than user
-
hasRights
public boolean hasRights(int level)
Check if current user has rights depending on level- Parameters:
level- a level id- Returns:
- true if current user has higher level than level
-
isAdmin
public boolean isAdmin()
Check if this user has admin rights- Returns:
- true if user has admin rights
-
isInRole
public boolean isInRole(String strRole)
Check if this user has a given role- Parameters:
strRole- The role key- Returns:
- true if user has the role
-
isPasswordReset
public boolean isPasswordReset()
Check if the password has been reinitialized- Returns:
- true if it has been reinitialized, false otherwise
-
setPasswordReset
public void setPasswordReset(boolean bIsPasswordReset)
Set pwd reseted- Parameters:
bIsPasswordReset- true if it has been reinitialized, false otherwise
-
setAccessibilityMode
public void setAccessibilityMode(boolean bAccessibilityMode)
Set the accessibility mode- Parameters:
bAccessibilityMode- true if the mode is accessible, false otherwise
-
getAccessibilityMode
public boolean getAccessibilityMode()
Return the accessibility mode- Returns:
- true if the mode is accessible, false otherwise
-
getDateLastLogin
public Timestamp getDateLastLogin()
Get the last login date of the user- Returns:
- The last login date of the user
-
setDateLastLogin
public void setDateLastLogin(Timestamp dateLastLogin)
Set the last login date of the user- Parameters:
dateLastLogin- The last login date of the user
-
getWorkgroupKey
public String getWorkgroupKey()
- Returns:
- the _strWorkgroupKey
-
setWorkgroupKey
public void setWorkgroupKey(String strWorkgroupKey)
- Parameters:
strWorkgroupKey- the _strWorkgroupKey to set
-
getWorkgroup
public String getWorkgroup()
- Specified by:
getWorkgroupin interfacefr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource
-
setUserInfo
public <X> X setUserInfo(String strKey, X info)
Sets a user info for the given key. User infos are intended to be lightweight attributes that do not expose a UI, by opposition theIAttributesystem. The user infos are not persisted. Subclasses can choose another strategy.- Type Parameters:
X- the value's type stored in the user map info- Parameters:
strKey- the keyinfo- the info- Returns:
- the previous value associated with strKey, or null if there was no mapping for strKey. (A null return can also indicate that null was previously associated with strKey)
- Since:
- 6.2.0
-
getUserInfo
public <X> X getUserInfo(String strKey)
Gets the user info for a given key- Type Parameters:
X- the value's type stored in the user map info- Parameters:
strKey- the key- Returns:
- the info
- Since:
- 6.2.0
- See Also:
setUserInfo(String, Object)
-
getDefaultDateLastLogin
public static Timestamp getDefaultDateLastLogin()
-
getUserWorkgroups
public List<String> getUserWorkgroups()
- Specified by:
getUserWorkgroupsin interfacefr.paris.lutece.api.user.User
-
setUserWorkgroups
public void setUserWorkgroups(List<String> workgroups)
Defines user's workgroups- Parameters:
worgroups- The User workgroups
-
getRealm
public String getRealm()
- Specified by:
getRealmin interfacefr.paris.lutece.api.user.User
-
-