- 1 NAME
- 2 DESCRIPTION
- 3 CORE METADATA FIELDS
- 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 loginattempts (int)
- 3.11 unlocktime (int)
- 3.12 joined (time)
- 3.13 email (email)
- 3.14 lang (arclanguage)
- 3.15 editperms (search, multiple)
- 3.16 frequency (set)
- 3.17 mailempty (boolean)
- 3.18 latitude (float)
- 3.19 longitude (float)
- 3.20 preference (storable)
- 3.21 captcha (recaptcha)
- 4 REFERENCES AND RELATED OBJECTS
- 5 METHODS
- 5.1 Constructor Methods
- 5.2 Class Methods
- 5.3 Object Methods
- 5.3.1 validate
- 5.3.2 commit
- 5.3.3 close_non_current_login_tickets
- 5.3.4 remove
- 5.3.5 is_staff
- 5.3.6 language
- 5.3.7 owned_eprints_list
- 5.3.8 editable_eprints_list
- 5.3.9 has_owner
- 5.3.10 mail
- 5.3.11 render
- 5.3.12 render_full
- 5.3.13 get_url
- 5.3.14 get_control_url
- 5.3.15 get_type
- 5.3.16 get_saved_searches
- 5.3.17 preference
- 5.3.18 set_preference
- 5.3.19 send_out_editor_alert
- 5.3.20 allow
- 5.3.21 has_privilege
- 5.3.22 get_privs
- 5.3.23 get_roles
- 5.3.24 has_role
- 5.4 Utility Methods
- 6 COPYRIGHT
EPrints::DataObj::User - Class representing a single user.
This class represents a single eprint user record and the metadata associated with it.
This class is a subclass of EPrints::DataObj with the following metadata fields, along with fields in cfg.d/user_fields.pl.
CORE METADATA FIELDS
The unique ID number of this user record. Unique within the current repository.
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.
The username of this user. Used for logging into the system. Unique within this repository.
The crypted password for this user as generated by EPrints::Utils/crypt. This may be ignored if for example LDAP authentication is being used.
The type of this user. The options are configured in metadata-phrases.xml.
Used to store a new but as yet unconfirmed email address.
Used to store a new but as yet unconfirmed password.
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.
When the pin code was set, so we can make it time out.
Number of login attempts since last successful login.
Time at which user account will be unlocked after too many failed login attempts.
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.
The email address of this user. Unique within the repository.
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.
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.
Only relevant to staff accounts. If set to true then emails are sent even if there are no items matching the scope.
The latitude of the location where the user is based.
The longitude of the location where the user is based.
User preferences which need to be persistent. Stored as a serialization of simple key-value pairs.
A ReCAPTCHA field to use to protect user password resets and similar forms from being spammed.
REFERENCES AND RELATED OBJECTS
saved_searches (subobject, multiple)
Saved searches created by this user.
item_fields (fields, multiple)
Stores bespoke metafields created by this user and stored in the database.
$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.
$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.
$user = EPrints::DataObj::User::create( $session, $user_type )
Create a new user in the database with the specified user type.
$dataobj = EPrints::DataObj->create_from_data( $session, $data, $dataset )
Create a new object of this type in the database.
$dataset is the dataset it will belong to.
$data is the data structured as with new_from_data.
$fields = EPrints::DataObj::User->get_system_field_info
Returns an array describing the system metadata of the the user dataset.
$dataset = EPrints::DataObj::User->get_dataset_id
Returns the ID of the EPrints::DataSet object to which this record belongs.
$problems = $user->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 problems then the array is empty.
The problems are XHTML DOM objects describing the problem.
$success = $user->commit( [ $force ] )
Writes this user data object to the database.
If $force is set and true then dave to the database even if no fields have changed. Otherwise, only save if at least one field has changed.
Returns a boolean depending on whether the user data object was successfully committed.
Close all login tickets for this user except the one they are currently logged in on.
$success = $user->remove
Remove this user from the database. Also, remove their saved searches, but do not remove their eprints.
$bool = $user->is_staff
Returns true if the user has_role is editor or admin.
$lang = $user->language
Get the preferred language of this user.
$list = $user->owned_eprints_list( %opts )
%opts is passed to a EPrints::Search, which is used to filter the results.
$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 eprints that match the given %opts is returned.
%opts is passed to a EPrints::Search which is used to filter the results.
$list = $user->editable_eprints_list( dataset => $repo->dataset( "buffer" ), );
$boolean = $user->has_owner( $possible_owner )
Returns true if $possible_owner is the same as this user.
$ok = $user->mail( $subjectid, $message, [$replyto, $email, $cc_list] )
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.
$cc_list is an optional CC list (array reference)
Returns true if the email was sent OK.
( $page, $title ) = $user->render
Returns XHTML DOM renderings of the page and the title for this user's page. This uses the configurable $user_render method that can typically be found in cfg.d/user_render.pl.
( $page, $title ) = $user->render_full
The same as render, but returns page and title renderings for all fields, not just those intended for public viewing. This is the admin view of the user.
$url = $user->get_url
Returns the URL which will display information about this user.
$url = $dataobj->get_control_url
Returns the URL for the control page for this user.
$type = $user->get_type
Return the type of this user.
$user->get_value( "usertype" )
@saved_searches = $eprint->get_saved_searches
Returns an array of all EPrint::DataObj::SavedSearch objects associated with this user.
$value = $user->preference( $key )
Returns the preference value for $key. Otherwise, returns undef.
$user->set_preference( $key, $value )
Set a preference $key to $value for this user.
Called on users who are editors, when it's time to send their update on what items are in the editorial review buffer. Typically called by process_editor_alerts.
Only sends the email if needed.
$result = $user->allow( $priv, [ $item ] )
Returns true if user can perform an action specified by $priv.
If set, further checks whether the user is permitted to perform the action of $priv on a particular $item data object.
$boolean = $user->has_privilege( $priv )
Returns true if $priv is in the user's privileges list.
$privs = $user->get_privs
Returns the privileges this user has. Currently just based on roles, but could do more later.
Returns a reference to a hash. Caching the result to save time in future.
@roles = $user->get_roles;
Returns the roles this user has. Each role represents a whole bunch of privileges.
$user->has_role( $roleid )
Returns boolean dependent on whether this user has the role $roleid.
$user = EPrints::DataObj::User::user_with_email( $repo, $email )
Returns the use with the specified $email, or undef if they cannot benot found.
$user = EPrints::DataObj::User::user_with_username( $session, $username )
Returns the user with the specified $username, or undef if they cannot be not found.
EPrints::DataObj::User::process_editor_alerts( $session, $frequency );
Called to send out all editor alerts of a given frequency (daily, weekly, monthly) for the current repository by the bin/send_alerts script that is configured as daily, weekly and monthly cron jobs.
© Copyright 2022 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.