API:EPrints/DataObj/User
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 DESCRIPTION
- 3 SYSTEM METADATA
- 3.1 userid (int)
- 3.2 rev_number (int)
- 3.3 username (text)
- 3.4 password (secret)
- 3.5 usertype (namedset)
- 3.6 newemail (email)
- 3.7 newpassword (secret)
- 3.8 pin (text)
- 3.9 pinsettime (int)
- 3.10 joined (time)
- 3.11 email (email)
- 3.12 lang (namedset)
- 3.13 editperms (search, multiple)
- 3.14 frequency (set)
- 3.15 mailempty (boolean)
- 3.16 preference (compound)
- 4 METHODS
- 4.1 get_system_field_info
- 4.2 new
- 4.3 new_from_data
- 4.4 get_dataset_id
- 4.5 get_defaults
- 4.6 user_with_email
- 4.7 user_with_username
- 4.8 validate
- 4.9 commit
- 4.10 remove
- 4.11 langauge
- 4.12 owned_eprints_list
- 4.13 editable_eprints_list
- 4.14 get_eprints
- 4.15 get_editable_eprints
- 4.16 get_owned_eprints
- 4.17 has_owner
- 4.18 mail
- 4.19 render
- 4.20 render_full
- 4.21 get_url
- 4.22 get_type
- 4.23 get_saved_searches
- 4.24 preference
- 4.25 set_preference
- 4.26 send_out_editor_alert
- 4.27 process_editor_alerts
- 4.28 allow
NAME
EPrints::DataObj::User - Class representing a single user.
DESCRIPTION
This class represents a single eprint user record and the metadata associated with it.
EPrints::DataObj::User is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in ArchiveMetadataFieldsConfig:
SYSTEM METADATA
userid (int)
The unique ID number of this user record. Unique within the current repository.
rev_number (int)
The revision number of this record. Each time it is changed the revision number is increased. This is not currently used for anything but it may be used for logging later.
username (text)
The username of this user. Used for logging into the system. Unique within this repository.
password (secret)
The password of this user encoded with crypt. This may be ignored if the repository is using an alternate authentication system, eg. LDAP.
usertype (namedset)
The type of this user. The options are configured in metadata-phrases.xml.
newemail (email)
Used to store a new but as yet unconfirmed email address.
newpassword (secret)
Used to store a new but as yet unconfirmed password.
pin (text)
A code required to confirm a new username or password. This code is emailed to the user to confirm they are who they say they are.
pinsettime (int)
When the pin code was set, so we can make it time out.
joined (time)
The date and time that the user account was created. Before EPrints 2.4 this was a date field so users created before the upgrade will appear to have been created at midnight.
email (email)
The email address of this user. Unique within the repository.
lang (namedset)
The ID of the prefered language of this user. Only really used in multilingual repositories.
editperms (search, multiple)
This field is used to filter what eprints a staff member can approve and modify. If it's unset then they can modify any (given the correct privs. but if it is set then an eprint must match at least one of the searches to be within their scope.
frequency (set)
Only relevant to staff accounts. Is the frequency they want to be mailed about eprints matching their scope that are in editorial review. never, daily, weekly or monthly.
mailempty (boolean)
Only relevant to staff accounts. If set to true then emails are sent even if there are no items matching the scope.
preference (compound)
User preferences which need to be persistent (simple key-value pairs).
METHODS
get_system_field_info
$field_info = EPrints::DataObj::User->get_system_field_info
Return an array describing the system metadata of the this dataset.
new
$user = EPrints::DataObj::User->new( $session, $userid )
Load the user with the ID of $userid from the database and return it as an EPrints::DataObj::User object.
new_from_data
$user = EPrints::DataObj::User->new_from_data( $session, $data )
Construct a new EPrints::DataObj::User object based on the $data hash reference of metadata.
Used to create an object from the data retrieved from the database.
get_dataset_id
$dataset = EPrints::DataObj::User->get_dataset_id
Returns the id of the EPrints::DataSet object to which this record belongs.
get_defaults
$defaults = EPrints::DataObj::User->get_defaults( $session, $data )
Return default values for this object based on the starting data.
user_with_email
$user = EPrints::DataObj::User::user_with_email( $session, $email )
Return the EPrints::user with the specified $email, or undef if they are not found.
user_with_username
$user = EPrints::DataObj::User::user_with_username( $session, $username )
Return the EPrints::user with the specified $username, or undef if they are not found.
validate
$problems = $thing->validate
Validate the user - find out if all the required fields are filled out, and that what's been filled in is OK. Returns a reference to an array of problem descriptions.
If there are no probelms then the array is empty.
The problems are XHTML DOM objects describing the problem.
commit
$user->commit( [$force] )
Write this object to the database.
If $force isn't true then it only actually modifies the database if one or more fields have been changed.
remove
$success = $user->remove
Remove this user from the database. Also, remove their saved searches, but do not remove their eprints.
langauge
$lang = $user->langauge()
Get the preferred language of the user.
owned_eprints_list
$list = $user->owned_eprints_list( %opts )
Returns a EPrints::List of all the EPrints::DataObj::EPrints owned by this user.
%opts is passed to a EPrints::Search which is used to filter the results.
editable_eprints_list
$list = $user->editable_eprints_list( %opts )
Returns a EPrints::List of EPrints::DataObj::EPrints that match this user's editorial search expressions. If the user has no editorial scope a list of all buffered eprints is returned.
%opts is passed to a EPrints::Search which is used to filter the results.
get_eprints
$list = $user->get_eprints( $dataset )
DEPRECATED
Return EPrints in the given EPrints::DataSet which have this user as their creator.
Since 2.4 this returns an EPrints::List object, not an array of eprints.
get_editable_eprints
$list = $user->get_editable_eprints
DEPRECATED
Return eprints currently in the editorial review buffer. If this user has editperms set then only return those records which match.
Since 2.4 this returns an EPrints::List object, not an array of eprints.
get_owned_eprints
$list = $user->get_owned_eprints( $dataset );
DEPRECATED
Return a list of the eprints which this user owns. This is by default the same as $user->get_eprints( $dataset) but may be over-ridden by get_users_owned_eprints.
Since 2.4 this returns an EPrints::List object, not an array of eprints.
has_owner
$boolean = $user->has_owner( $possible_owner )
True if the users are the same record.
$ok = $user->mail( $subjectid, $message, [$replyto], [$email] )
Send an email to this user.
$subjectid is the ID of a phrase to use as the subject of this email.
$message is an XML DOM object describing the message in simple XHTML.
$replyto is the reply to address for this email, if different to the repository default.
$email is the email address to send this email to if different from this users configured email address.
Return true if the email was sent OK.
render
( $page, $title ) = $user->render
Render this user into HTML using the "user_render" method in ArchiveRenderConfig.pm. Returns both the rendered information and the title as XHTML DOM.
render_full
( $page, $title ) = $user->render_full
The same as $user->render, but renders all fields, not just those intended for public viewing. This is the admin view of the user.
get_url
$url = $user->get_url
Return the URL which will display information about this user.
If $staff is true then return the URL for an administrator to view and modify this record.
get_type
$type = $user->get_type
Return the type of this user. Equivalent of $user->get_value( "usertype" );
get_saved_searches
@saved_searches = $eprint->get_saved_searches
Return an array of all EPrint::DataObj::SavedSearch objects associated with this user.
preference
$value = $user->preference( $key )
Retrieve the preference $key.
set_preference
$user->set_preference( $key, $value )
Set a preference $key for the user to $value.
send_out_editor_alert
$user->send_out_editor_alert
Called on users who are editors, when it's time to send their update on what items are in the editorial review buffer.
Sends the email if needed.
process_editor_alerts
EPrints::DataObj::User::process_editor_alerts( $session, $frequency );
Static method.
Called to send out all editor alerts of a given frequency (daily, weekly, monthly) for the current repository.
allow
$result = $user->allow( $priv, [$item] )
Returns true if $user can perform this action/view this screen.
A true result is 1..15 where the value indicates what about the user allowed the priv to be performed. This is used for filtering owner/ editor actions in eprint control screens.
1 = anybody (not currently used) 2 = only if logged in 4 = only if owner of item 8 = only if editor of item
For non item related privs the result will normally be 2.
Nb. That create eprint is NOT a priv related to an eprint, as you don't own it at that stage.