Package ch.ivyteam.ivy.security
Interface IUser
- All Superinterfaces:
ISecurityMember
A user
- Since:
- 17.05.2006
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a role the user can act ascreateAbsence
(Date startDateInclusive, Date stopDateInclusive, String description) Creates a new absence for a time period.createSubstitute
(IUser mySubstitute, IRole forThisRole, String description) Creates a new substitute for a specific role.createSubstitute
(IUser mySubstitute, String description, SubstitutionType type) Creates a new substitute for personal tasks.void
deleteAbsence
(IUserAbsence absence) Deletes a absencevoid
deleteSubstitute
(IUserSubstitute substitute) Deletes a substituteGets all absences of the userGets all active user substitutes where this user is the substitute userGets all property names of the userGet all roles the user owns (directly and indirectly)Gets the e-mail address of the userdefault Locale
Deprecated.Gets the id of this user in the external security systemGets the full qualified name of the user in the external security systemdefault String
Deprecated.usegetExternalName()
insteadReturns the full name of the userGets the language of the usergetProperty
(String name) Gets a property of the usergetRoles()
Get roles the user owns directGets all substitutes.Gets all user substitutes where this user is the substitute userGets a user token for this userhas()
Test if the user owns roles.boolean
isAbsent()
Is the session user currently absent.boolean
Whether or not the user is managed by an external security system.boolean
isPropertyBacked
(String name) Indicates whether the given property is backed in an external directory (e.g.Gets the locations of the user.removeProperty
(String name) Removes a property from the uservoid
removeRole
(IRole role) Remove a role the user can act asvoid
setEMailAddress
(String eMailAddress) Sets the e-mail address of the userdefault void
setEMailLanguage
(Locale defaultLanguage) Deprecated.void
setExternalName
(String externalName) This method is only executable for the system user Sets the full qualified name of the user in the external security system.default void
setExternalSecurityName
(String externalName) Deprecated.usesetExternalName(String)
insteadvoid
setFullName
(String fullUserName) Sets the full name of the uservoid
setLanguage
(Locale language) Sets the language of the user.void
setPassword
(String password) Sets the password of the uservoid
setProperty
(String name, String value) Sets a property to the userMethods inherited from interface ch.ivyteam.ivy.security.ISecurityMember
disable, enable, getDisplayName, getId, getMemberName, getName, getSecurityContext, isEnabled, isMember, isUser
-
Method Details
-
getFullName
String getFullName()Returns the full name of the user- Returns:
- full name of the user
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnFullName PERMISSION) OR OWNS UserReadFullName PERMISSION OR OWNS UserReadFullName@SYSTEM PERMISSION
-
setFullName
Sets the full name of the user- Parameters:
fullUserName
- the full name of the user- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserSetOwnFullName PERMISSION) OR OWNS UserSetFullName PERMISSION OR OWNS UserSetFullName@SYSTEM PERMISSION
-
getEMailLanguage
Deprecated.usegetLanguage()
- API:
- This public API is available in Java.
-
getLanguage
Locale getLanguage()Gets the language of the user- Returns:
- language, can be
null
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnEMailLanguage PERMISSION) OR OWNS UserReadEMailLanguage PERMISSION OR OWNS UserReadEMailLanguage@SYSTEM PERMISSION
-
setEMailLanguage
Deprecated.- API:
- This public API is available in Java.
-
setLanguage
Sets the language of the user.- Parameters:
language
- of the user, can benull
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserSetOwnEMailLanguage PERMISSION) OR OWNS UserSetEMailLanguage PERMISSION OR OWNS UserSetEMailLanguage@SYSTEM PERMISSION
-
setExternalSecurityName
Deprecated.usesetExternalName(String)
insteadThis method is only executable for the system user Sets the full qualified name of the user in the external security system. It's strongly recommended to leave this to the import and not set the external name manually.- Parameters:
externalName
-- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
-
setExternalName
This method is only executable for the system user Sets the full qualified name of the user in the external security system. It's strongly recommended to leave this to the import and not set the external name manually.- Parameters:
externalName
-- Throws:
PersistencyException
- if persistency access fails- Since:
- 9.1
- API:
- This public API is available in Java.
- Security:
- SESSION IS SYSTEM
-
setPassword
Sets the password of the user- Parameters:
password
- the new password- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserSetOwnPassword PERMISSION) OR OWNS UserSetPassword PERMISSION OR OWNS UserSetPassword@SYSTEM PERMISSION
-
addRole
Add a role the user can act as- Parameters:
role
- The role to add- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS UserAddRole PERMISSION OR OWNS UserAddRole@SYSTEM PERMISSION
-
removeRole
Remove a role the user can act as- Parameters:
role
- The role to remove- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS UserRemoveRole PERMISSION OR OWNS UserRemoveRole@SYSTEM PERMISSION
-
getRoles
Get roles the user owns direct- Returns:
- list with roles
- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnRoles PERMISSION) OR OWNS UserReadRoles PERMISSION OR OWNS UserReadRoles@SYSTEM PERMISSION
-
getAllRoles
Get all roles the user owns (directly and indirectly)- Returns:
- list with roles
- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnRoles PERMISSION) OR OWNS UserReadRoles PERMISSION OR OWNS UserReadRoles@SYSTEM PERMISSION
-
has
IRoleMatcher has()Test if the user owns roles.Example:
IUser user = ...; user.has().role("Manager");
- Since:
- 9.3
- See Also:
- API:
- This public API is available in Java.
-
setProperty
Sets a property to the user- Parameters:
name
- Name of the property to set (maximum 255 characters)value
- Value of the property to set- Throws:
IllegalArgumentException
- If the property name has more than 255 charactersPersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserSetOwnProperty PERMISSION) OR OWNS UserSetProperty PERMISSION OR OWNS UserSetProperty@SYSTEM PERMISSION
-
getProperty
Gets a property of the user- Parameters:
name
- Name of the property- Returns:
- property value or null if no such property exists
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnProperty PERMISSION) OR OWNS UserReadProperty PERMISSION OR OWNS UserReadProperty@SYSTEM PERMISSION
-
removeProperty
Removes a property from the user- Parameters:
name
- Name of the property to remove- Returns:
- property value or null if no such property exists
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserRemoveOwnProperty PERMISSION) OR OWNS UserRemoveProperty PERMISSION OR OWNS UserRemoveProperty@SYSTEM PERMISSION
-
getAllPropertyNames
Gets all property names of the user- Returns:
- Enumeration with the property names
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnPropertyNames PERMISSION) OR OWNS UserReadPropertyNames PERMISSION OR OWNS UserReadPropertyNames@SYSTEM PERMISSION
-
isPropertyBacked
Indicates whether the given property is backed in an external directory (e.g. Microsoft AD oder Novell eDirectory).- Parameters:
name
- the name of the property- Returns:
- true, if the property is backed; false if not
- Throws:
PersistencyException
- API:
- This public API is available in Java.
-
getEMailAddress
String getEMailAddress()Gets the e-mail address of the user- Returns:
- e-mail address
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnEMailAddress PERMISSION) OR OWNS UserReadEMailAddress PERMISSION OR OWNS UserReadEMailAddress@SYSTEM PERMISSION
-
setEMailAddress
Sets the e-mail address of the user- Parameters:
eMailAddress
- the new e-mail address to set- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserSetOwnEMailAddress PERMISSION) OR OWNS UserSetEMailAddress PERMISSION OR OWNS UserSetEMailAddress@SYSTEM PERMISSION
-
createAbsence
Creates a new absence for a time period.Absence is calculated on the exact date:time basis, so that please set absences exactly (e.g. from 0:00 of the starting day till 23:59 of the last absence day)
- Parameters:
startDateInclusive
- the start date of the absence (from specified date:time; null is not acceptable)stopDateInclusive
- the stop date of the absence (until specifieddate:time
; Recommended to set 23:59 on the last day). Null means open enddescription
- textual description of this absence- Returns:
- the new absence
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserCreateOwnAbsence PERMISSION) OR OWNS UserCreateAbsence PERMISSION OR OWNS UserCreateAbsence@SYSTEM PERMISSION
-
deleteAbsence
Deletes a absence- Parameters:
absence
- the absence to delete- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserDeleteOwnAbsence PERMISSION) OR OWNS UserDeleteAbsence PERMISSION OR OWNS UserDeleteAbsence@SYSTEM PERMISSION
-
getAbsences
List<IUserAbsence> getAbsences()Gets all absences of the user- Returns:
- iterator with the absences
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnAbsences PERMISSION) OR OWNS UserReadAbsences PERMISSION OR OWNS UserReadAbsences@SYSTEM PERMISSION
-
isAbsent
boolean isAbsent()Is the session user currently absent.Absence is calculated on exact date:time base, so that please set absences exactly
(e.g. till 23:59 of selected day if you want an absence for the whole day)- Returns:
- true if it is absent, otherwise false
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
-
createSubstitute
Creates a new substitute for a specific role. For personal substitution usecreateSubstitute(IUser mySubstitute, String description, SubstitutionType type)
instead.- Parameters:
mySubstitute
- a user which is the substitute of this userforThisRole
- a role for which the substitute user substitutes medescription
- the description- Returns:
- the new substitute
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserCreateOwnSubstitute PERMISSION) OR OWNS UserCreateSubstitute PERMISSION OR OWNS UserCreateSubstitute@SYSTEM PERMISSION
-
createSubstitute
Creates a new substitute for personal tasks. For role substitution usecreateSubstitute(IUser mySubstitute, IRole role, String description)
instead.- Parameters:
mySubstitute
- a user which is the substitute of this userdescription
- the descriptiontype
- when is the substitute active.- Returns:
- the new substitute
- Throws:
PersistencyException
- if persistency access fails- Since:
- 7.3
- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserCreateOwnSubstitute PERMISSION) OR OWNS UserCreateSubstitute PERMISSION OR OWNS UserCreateSubstitute@SYSTEM PERMISSION
-
deleteSubstitute
Deletes a substitute- Parameters:
substitute
- the substitute to delete- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserDeleteOwnSubstitute PERMISSION) OR OWNS UserDeleteSubstitute PERMISSION OR OWNS UserDeleteSubstitute@SYSTEM PERMISSION
-
getSubstitutes
List<IUserSubstitute> getSubstitutes()Gets all substitutes. A substitute is a user which acts as a substitute for one of my roles (or personally) during my absences.- Returns:
- iterator with all substitutes
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnSubstitutes PERMISSION) OR OWNS UserReadSubstitutes PERMISSION OR OWNS UserReadSubstitutes@SYSTEM PERMISSION
-
getUserToken
IUserToken getUserToken()Gets a user token for this user- Returns:
- The user token
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
-
getSubstitutions
List<IUserSubstitute> getSubstitutions()Gets all user substitutes where this user is the substitute user- Returns:
- list with user substitutes
- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnSubstitutions PERMISSION) OR OWNS UserReadSubstitutions PERMISSION OR OWNS UserReadSubstitutions@SYSTEM PERMISSION
-
getActiveSubstitutions
List<IUserSubstitute> getActiveSubstitutions()Gets all active user substitutes where this user is the substitute user- Returns:
- list with active user substitutes
- Throws:
PersistencyException
- if persistency access fails- See Also:
- API:
- This public API is available in Java.
-
getExternalSecurityName
Deprecated.usegetExternalName()
insteadGets the name of the user in the external security system- Returns:
- external security user name maybe null
- Throws:
PersistencyException
- if persistency access fails- API:
- This public API is available in Java.
-
getExternalName
String getExternalName()Gets the full qualified name of the user in the external security system- Returns:
- full qualified user name in the external security, maybe null
- Throws:
PersistencyException
- if persistency access fails- Since:
- 9.1
- API:
- This public API is available in Java.
- Security:
- SESSION (MATCHES THIS AND OWNS UserReadOwnExternalSecurityName PERMISSION) OR OWNS UserReadExternalSecurityName PERMISSION OR OWNS UserReadExternalSecurityName@SYSTEM PERMISSION
-
getExternalId
String getExternalId()Gets the id of this user in the external security system- Returns:
- external security user id maybe null
- Throws:
PersistencyException
- if persistency access fails- Since:
- 9.1
- API:
- This public API is available in Java.
-
isExternal
boolean isExternal()Whether or not the user is managed by an external security system.- Returns:
- true if its managed by an external security system otherwise false.
- Since:
- 9.1
- API:
- This public API is available in Java.
-
locations
ILocationService locations()Gets the locations of the user.
Example:
import ch.ivyteam.ivy.location.ILocation; ILocation location = ivy.session.getSessionUser().locations().getLatest(); if (location != null) { ivy.log.info("Last known position of user "+ivy.session.getSessionUserName()+" was "+location.getPosition()); }
- Returns:
- location service
- API:
- This public API is available in Java.
-
getLanguage()