Interface EPersonService
- All Superinterfaces:
DSpaceObjectLegacySupportService<EPerson>,DSpaceObjectService<EPerson>
- All Known Implementing Classes:
EPersonServiceImpl
Methods for handling registration by email and forgotten passwords. When someone registers as a user, or forgets their password, the sendRegistrationInfo or sendForgotPasswordInfo methods can be used to send an email to the user. The email contains a special token, a long string which is randomly generated and thus hard to guess. When the user presents the token back to the system, the AccountManager can use the token to determine the identity of the eperson.
*NEW* now ignores expiration dates so that tokens never expire.
- Author:
- Peter Breton, kevinvandevelde at atmire.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MetadataFieldNamestatic final MetadataFieldNamestatic final MetadataFieldNamestatic final MetadataFieldNameFields inherited from interface org.dspace.content.service.DSpaceObjectService
MD_COPYRIGHT_TEXT, MD_INTRODUCTORY_TEXT, MD_LICENSE, MD_NAME, MD_PROVENANCE_DESCRIPTION, MD_SHORT_DESCRIPTION, MD_SIDEBAR_TEXT, MD_SOURCE, MD_USER_FORMAT_DESCRIPTION -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckPassword(Context context, EPerson ePerson, String attempt) Check EPerson's password.intcountByGroups(Context c, Set<Group> groups) Count all EPerson accounts which belong to at least one of the specified groups.intcountTotal(Context context) Count all accounts.Create a new epersonDeprecated.Find all theEPersons in a specific order by field.findByEmail(Context context, String email) Find the eperson by their email address.findByGroups(Context c, Set<Group> groups) Retrieve all EPerson accounts which belong to at least one of the specified groups.findByGroups(Context c, Set<Group> groups, int pageSize, int offset) Retrieve all EPerson accounts which belong to at least one of the specified groups, in a paginated fashion.findByNetid(Context context, String netId) Find the eperson by their netid.findByProfileItem(Context context, Item profile) Find the EPerson related to the given profile item.findEPeopleWithSubscription(Context context) Retrieve all accounts which are subscribed to receive information about new items.findNotActiveSince(Context context, Instant date) Retrieve all accounts which have not logged in since the specified datefindUnsalted(Context context) Retrieve all accounts which have a password but do not have a digest algorithmgetDeleteConstraints(Context context, EPerson ePerson) Check for presence of EPerson in tables that have constraints on EPersons.getPasswordHash(EPerson ePerson) Return the EPerson's password hash.@NotNull EPersongetSystemEPerson(Context context) The "System EPerson" is a fake account that exists only to receive email.Find the epeople that match the search query across firstname, lastname or email.Find the epeople that match the search query across firstname, lastname or email.searchNonMembers(Context context, String query, Group excludeGroup, int offset, int limit) Find the EPersons that match the search query which are NOT currently members of the given Group.intsearchNonMembersCount(Context context, String query, Group excludeGroup) Returns the total number of EPersons that match the search query which are NOT currently members of the given Group.intsearchResultCount(Context context, String query) Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.voidsetPassword(EPerson ePerson, String password) Set the EPerson's password.voidsetPasswordHash(EPerson ePerson, PasswordHash password) Set the EPerson's password hash.Methods inherited from interface org.dspace.content.service.DSpaceObjectLegacySupportService
findByIdOrLegacyId, findByLegacyId, getSupportsTypeConstantMethods inherited from interface org.dspace.content.service.DSpaceObjectService
addAndShiftRightMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, addMetadata, clearMetadata, delete, find, getAdminObject, getIdentifiers, getMetadata, getMetadata, getMetadata, getMetadata, getMetadataByMetadataString, getMetadataFirstValue, getMetadataFirstValue, getName, getParentObject, getSupportsTypeConstant, getTypeText, moveMetadata, removeMetadataValues, replaceMetadata, setMetadataModified, setMetadataSingleValue, setMetadataSingleValue, update, updateLastModified
-
Field Details
-
MD_FIRSTNAME
-
MD_LASTNAME
-
MD_PHONE
-
MD_LANGUAGE
-
-
Method Details
-
findByEmail
Find the eperson by their email address.- Parameters:
context- The relevant DSpace Context.email- EPerson's email to search by- Returns:
- EPerson, or
nullif none such exists. - Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByNetid
Find the eperson by their netid.- Parameters:
context- The relevant DSpace Context.netId- Network ID- Returns:
- corresponding EPerson, or
null - Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
search
Find the epeople that match the search query across firstname, lastname or email.- Parameters:
context- The relevant DSpace Context.query- The search string- Returns:
- array of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
search
Find the epeople that match the search query across firstname, lastname or email. This method also allows offsets and limits for pagination purposes.- Parameters:
context- The relevant DSpace Context.query- The search stringoffset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
searchResultCount
Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.- Parameters:
context- The relevant DSpace Context.query- The search string- Returns:
- the number of epeople matching the query
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
searchNonMembers
List<EPerson> searchNonMembers(Context context, String query, Group excludeGroup, int offset, int limit) throws SQLException Find the EPersons that match the search query which are NOT currently members of the given Group. The search query is run against firstname, lastname or email.- Parameters:
context- DSpace contextquery- The search stringexcludeGroup- Group to exclude results from. Members of this group will never be returned.offset- Inclusive offset (the position of the first result to return)limit- Maximum number of matches returned- Returns:
- List of matching EPerson objects
- Throws:
SQLException- if error
-
searchNonMembersCount
Returns the total number of EPersons that match the search query which are NOT currently members of the given Group. The search query is run against firstname, lastname or email. Can be used with searchNonMembers() to support pagination- Parameters:
context- DSpace contextquery- The search stringexcludeGroup- Group to exclude results from. Members of this group will never be returned.- Returns:
- List of matching EPerson objects
- Throws:
SQLException- if error
-
findAll
Deprecated.use the paginated methodfindAll(org.dspace.core.Context,int).Find all theEPersons in a specific order by field. The sortable fields are:IDLASTNAMEEMAILNETID
- Parameters:
context- The relevant DSpace Context.sortField- which field to sort EPersons by- Returns:
- list of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAll
Find all theEPersons in a specific order by field. The sortable fields are:IDLASTNAMEEMAILNETID
- Parameters:
context- The relevant DSpace Context.sortField- which field to sort EPersons bypageSize- how many results returnoffset- the position of the first result to return- Returns:
- list of EPerson objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getSystemEPerson
The "System EPerson" is a fake account that exists only to receive email. It has an email address that should be presumed usable. It does not exist in the database and is not complete.- Parameters:
context- current DSpace session.- Returns:
- an EPerson that can presumably receive email.
- Throws:
SQLException
-
create
Create a new eperson- Parameters:
context- The relevant DSpace Context.- Returns:
- the created EPerson
- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
setPassword
Set the EPerson's password.- Parameters:
ePerson- EPerson whose password we want to set.password- the new password.
-
setPasswordHash
Set the EPerson's password hash.- Parameters:
ePerson- EPerson whose password hash we want to set.password- hashed password, or null to set row data to NULL.
-
getPasswordHash
Return the EPerson's password hash.- Parameters:
ePerson- EPerson whose password hash we want to get.- Returns:
- hash of the password, or null on failure (such as no password).
-
checkPassword
Check EPerson's password. Side effect: original unsalted MD5 hashes are converted using the current algorithm.- Parameters:
context- The relevant DSpace Context.ePerson- EPerson whose password we want to checkattempt- the password attempt- Returns:
- boolean successful/unsuccessful
-
findUnsalted
Retrieve all accounts which have a password but do not have a digest algorithm- Parameters:
context- The relevant DSpace Context.- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findNotActiveSince
Retrieve all accounts which have not logged in since the specified date- Parameters:
context- The relevant DSpace Context.date- from which date- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getDeleteConstraints
Check for presence of EPerson in tables that have constraints on EPersons. Called by delete() to determine whether the eperson can actually be deleted. An EPerson cannot be deleted if it exists in the item, resourcepolicy or workflow-related tables.- Parameters:
context- The relevant DSpace Context.ePerson- EPerson to find- Returns:
- List of tables that contain a reference to the eperson.
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByGroups
Retrieve all EPerson accounts which belong to at least one of the specified groups.WARNING: This method may have bad performance issues for Groups with a very large number of members, as it will load all member EPerson objects into memory.
For better performance, use the paginated version of this method.
- Parameters:
c- The relevant DSpace Context.groups- set of eperson groups- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByGroups
List<EPerson> findByGroups(Context c, Set<Group> groups, int pageSize, int offset) throws SQLException Retrieve all EPerson accounts which belong to at least one of the specified groups, in a paginated fashion.- Parameters:
c- The relevant DSpace Context.groups- Set of group(s) to check membership inpageSize- number of EPerson objects to load at one time. Set to <=0 to disable paginationoffset- number of page to load (starting with 1). Set to <=0 to disable pagination- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
countByGroups
Count all EPerson accounts which belong to at least one of the specified groups. This provides the total number of results to expect from corresponding findByGroups() for pagination purposes.- Parameters:
c- The relevant DSpace Context.groups- Set of group(s) to check membership in- Returns:
- total number of (unique) EPersons who are a member of one or more groups.
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findEPeopleWithSubscription
Retrieve all accounts which are subscribed to receive information about new items.- Parameters:
context- The relevant DSpace Context.- Returns:
- a list of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
countTotal
Count all accounts.- Parameters:
context- The relevant DSpace Context.- Returns:
- the total number of epeople
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findByProfileItem
Find the EPerson related to the given profile item. If the given item is not a profile item, null is returned.- Parameters:
context- The relevant DSpace Context.profile- the profile item to search for- Returns:
- the EPerson, if any
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
findAll(org.dspace.core.Context,int).