Difference between revisions of "API:EPrints/DataObj/User"

From EPrints Documentation
Jump to: navigation, search
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost.
+
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{API:Source|file=EPrints/DataObj/User.pm|package_name=EPrints::DataObj::User}}[[Category:API|User]]<!-- End of Pod2Wiki -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/User.pm|package_name=EPrints::DataObj::User}}[[Category:API|USER]][[Category:API:EPrints/DataObj|USER]]<div><!-- Edit below this comment -->
<!-- Pod2Wiki=head_name -->'''EPrints::DataObj::User''' - Class representing a single user.
 
__TOC__
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_description -->=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 followingmetadata fields (plus those defined in ArchiveMetadataFieldsConfig:
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_system_metadata -->=SYSTEM METADATA=
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_userid -->==userid==
 
  
  userid (int)
 
  
The unique ID number of this user record. Unique within the current repository.
+
<!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name -->
<!-- End of Pod2Wiki -->
+
==NAME==
<!-- Pod2Wiki=item_rev_number -->==rev_number==
+
'''EPrints::DataObj::User''' - Class representing a single user.
  
  rev_number (int)
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
The revision number of this record. Each time it is changed the revisionnumber is increased. This is not currently used for anything but it maybe used for logging later.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_username -->==username==
 
  
  username (text)
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_description -->
 +
==DESCRIPTION==
 +
This class represents a single eprint user record and the metadata  associated with it.
  
The username of this user. Used for logging into the system. Unique withinthis repository.
+
This class is a subclass of [[API:EPrints/DataObj|EPrints::DataObj]] with the following metadata fields, along with fields in <tt>cfg.d/user_fields.pl</tt>.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_password -->==password==
 
  
  password (secret)
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
The password of this user encoded with crypt. This may be ignored if therepository is using an alternate authentication system, eg. LDAP.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_usertype -->==usertype==
 
  
  usertype (namedset)
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_core_metadata_fields -->
 +
==CORE METADATA FIELDS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
The type of this user. The options are configured in metadata-phrases.xml.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_newemail -->==newemail==
 
  
  newemail (email)
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_userid -->
 +
===userid (int)===
 +
 
 +
The unique ID number of this user record. Unique within the current  repository.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_rev_number -->
 +
===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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_username -->
 +
===username (text)===
 +
 
 +
The username of this user. Used for logging into the system. Unique  within this repository.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_password -->
 +
===password (secret)===
 +
 
 +
The crypted password for this user as generated by  [[API:EPrints/Utils#crypt|EPrints::Utils/crypt]]. This may be ignored if for example LDAP  authentication is being used.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_usertype -->
 +
===usertype (namedset)===
 +
 
 +
The type of this user. The options are configured in  <tt>metadata-phrases.xml</tt>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_newemail -->
 +
===newemail (email)===
  
 
Used to store a new but as yet unconfirmed email address.
 
Used to store a new but as yet unconfirmed email address.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_newpassword -->==newpassword==
 
  
  newpassword (secret)
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_newpassword -->
 +
===newpassword (secret)===
  
 
Used to store a new but as yet unconfirmed password.
 
Used to store a new but as yet unconfirmed password.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_pin -->==pin==
 
  
  pin (text)
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
A code required to confirm a new username or password. This code is emailedto the user to confirm they are who they say they are.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_pinsettime -->==pinsettime==
 
  
  pinsettime (int)
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_pin -->
 +
===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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_pinsettime -->
 +
===pinsettime (int)===
  
 
When the pin code was set, so we can make it time out.
 
When the pin code was set, so we can make it time out.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_joined -->==joined==
 
  
  joined (time)
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_loginattempts -->
 +
===loginattempts (int)===
 +
 
 +
Number of login attempts since last successful login.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_unlocktime -->
 +
===unlocktime (int)===
 +
 
 +
Time at which user account will be unlocked after too many failed  login attempts.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
The date and time that the user account was created. Before EPrints 2.4 thiswas a date field so users created before the upgrade will appear to have been created at midnight.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_email -->==email==
 
  
  email (email)
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_joined -->
 +
===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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_email -->
 +
===email (email)===
  
 
The email address of this user. Unique within the repository.  
 
The email address of this user. Unique within the repository.  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_lang -->==lang==
 
  
  lang (namedset)  
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_lang -->
 +
===lang (arclanguage) ===
 +
 
 +
The ID of the prefered language of this user. Only really used in  multilingual repositories.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_editperms -->
 +
===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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_frequency -->
 +
===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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_mailempty -->
 +
===mailempty (boolean)===
 +
 
 +
Only relevant to staff accounts. If set to true then emails are  sent even if there are no items matching the scope.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_latitude -->
 +
===latitude (float)===
 +
 
 +
The latitude of the location where the user is based.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_longitude -->
 +
===longitude (float)===
 +
 
 +
The longitude of the location where the user is based.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_preference -->
 +
===preference (storable)===
 +
 
 +
User preferences which need to be persistent. Stored as a  serialization of simple key-value pairs.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_captcha -->
 +
===captcha (recaptcha)===
 +
 
 +
A ReCAPTCHA field to use to protect user password resets and  similar forms from being spammed.
  
The ID of the prefered language of this user. Only really used in multilingualrepositories.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=item_editperms -->==editperms==
+
<!-- Edit below this comment -->
  
  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. butif it is set then an eprint must match at least one of the searches to bewithin their scope.
+
<!-- Pod2Wiki= -->
<!-- End of Pod2Wiki -->
+
</div>
<!-- Pod2Wiki=item_frequency -->==frequency==
+
<!-- Pod2Wiki=head_references_and_related_objects -->
 +
==REFERENCES AND RELATED OBJECTS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  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.
+
<!-- Pod2Wiki= -->
<!-- End of Pod2Wiki -->
+
</div>
<!-- Pod2Wiki=item_mailempty -->==mailempty==
+
<!-- Pod2Wiki=item_saved_searches -->
 +
===saved_searches (subobject, multiple)===
  
  mailempty (boolean)
+
Saved searches created by this user.
  
Only relevant to staff accounts. If set to true then emails are senteven if there are no items matching the scope.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=head_methods -->=METHODS=
+
<!-- Edit below this comment -->
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_system_field_info -->==get_system_field_info==
 
  
  $field_info = EPrints::DataObj::User-&gt;get_system_field_info
 
  
Return an array describing the system metadata of the this dataset.
+
<!-- Pod2Wiki= -->
<!-- End of Pod2Wiki -->
+
</div>
<!-- Pod2Wiki=item_new -->==new==
+
<!-- Pod2Wiki=item_item_fields -->
 +
===item_fields (fields, multiple)===
  
  $user = EPrints::DataObj::User-&gt;new( $session, $userid )
+
Stores bespoke metafields created by this user and stored in the database.
  
Load the user with the ID of $userid from the database and returnit as an EPrints::DataObj::User object.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=item_new_from_data -->==new_from_data==
+
<!-- Edit below this comment -->
  
  $user = EPrints::DataObj::User-&gt;new_from_data( $session, $data )
 
  
Construct a new EPrints::DataObj::User object based on the $data hash reference of metadata.
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_instance_variables -->
 +
==INSTANCE VARIABLES==
 +
See [[API:EPrints/DataObj#INSTANCE_VARIABLES|EPrints::DataObj]].
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_methods -->
 +
==METHODS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_constructor_methods -->
 +
===Constructor Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_new -->
 +
====new====
 +
 
 +
$user = EPrints::DataObj::User-&gt;new( $session, $userid )
 +
Load the user with the ID of $userid from the database and return it as an EPrints::DataObj::User object.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_new_from_data -->
 +
====new_from_data====
 +
 
 +
$user = EPrints::DataObj::User-&gt;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.
 
Used to create an object from the data retrieved from the database.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_dataset_id -->==get_dataset_id==
 
  
  $dataset = EPrints::DataObj::User-&gt;get_dataset_id
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_create -->
 +
====create====
 +
 
 +
$user = EPrints::DataObj::User::create( $session, $user_type )
 +
Create a new user in the database with the specified user type.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_create_from_data -->
 +
====create_from_data====
 +
 
 +
$dataobj = EPrints::DataObj-&gt;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.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_class_methods -->
 +
===Class Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_system_field_info -->
 +
====get_system_field_info====
 +
 
 +
$fields = EPrints::DataObj::User-&gt;get_system_field_info
 +
Returns an array describing the system metadata of the the user  dataset.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_dataset_id -->
 +
====get_dataset_id====
  
Returns the id of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
+
$dataset = EPrints::DataObj::User-&gt;get_dataset_id
<!-- End of Pod2Wiki -->
+
Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
<!-- Pod2Wiki=item_get_defaults -->==get_defaults==
 
  
  $defaults = EPrints::DataObj::User-&gt;get_defaults( $session, $data )
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Return default values for this object based on the starting data.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_user_with_email -->==user_with_email==
 
  
  $user = EPrints::DataObj::User::user_with_email( $session, $email )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_object_methods -->
 +
===Object Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Return the EPrints::user with the specified $email, or undef if theyare not found.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_user_with_username -->==user_with_username==
 
  
  $user = EPrints::DataObj::User::user_with_username( $session, $username )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_validate -->
 +
====validate====
  
Return the EPrints::user with the specified $username, or undef if they are not found.
+
$problems = $user-&gt;validate
<!-- End of Pod2Wiki -->
+
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.
<!-- Pod2Wiki=item_validate -->==validate==
 
  
  $problems = $thing-&gt;validate
+
If there are no problems then the array is empty.
  
Validate the user - find out if all the required fields are filledout, and that what's been filled in is OK. Returns a reference to anarray of problem descriptions.
 
If there are no probelms then the array is empty.
 
 
The problems are XHTML DOM objects describing the problem.
 
The problems are XHTML DOM objects describing the problem.
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_commit -->==commit==
 
  
  $user-&gt;commit( [$force] )
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_commit -->
 +
====commit====
 +
 
 +
$success = $user-&gt;commit( [ $force ] )
 +
Writes this user data object to the database.
 +
 
 +
If <tt>$force</tt> is set and <tt>true</tt> 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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_close_non_current_login_tickets -->
 +
====close_non_current_login_tickets====
 +
 
 +
$user-&gt;close_non_current_login_tickets
 +
Close all login tickets for this user except the one they are  currently logged in on.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_remove -->
 +
====remove====
 +
 
 +
$success = $user-&gt;remove
 +
Remove this user from the database. Also, remove their saved searches, but do not remove their eprints.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_is_staff -->
 +
====is_staff====
 +
 
 +
$bool = $user-&gt;is_staff
 +
Returns true if the user [[API:EPrints/DataObj/User#has_role|has_role]] is <tt>editor</tt> or <tt>admin</tt>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
  
Write this object to the database.
+
<!-- Pod2Wiki= -->
If $force isn't true then it only actually modifies the databaseif one or more fields have been changed.
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_language -->
<!-- Pod2Wiki=item_remove -->==remove==
+
====language====
  
  $success = $user-&gt;remove
+
$lang = $user-&gt;language
 +
Get the preferred language of this user.
  
Remove this user from the database. Also, remove their saved searches,but do not remove their eprints.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=item_get_eprints -->==get_eprints==
+
<!-- Edit below this comment -->
  
  $list = $user-&gt;get_eprints( $dataset )
 
  
Return EPrints in the given EPrints::DataSet which have this useras their creator.
+
<!-- Pod2Wiki= -->
Since 2.4 this returns an EPrints::List object, not an array of eprints.
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_owned_eprints_list -->
<!-- Pod2Wiki=item_get_editable_eprints -->==get_editable_eprints==
+
====owned_eprints_list====
  
  $list = $user-&gt;get_editable_eprints
+
$list = $user-&gt;owned_eprints_list( %opts )
 +
Returns a [[API:EPrints/List|EPrints::List]] of all the [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]]s  owned by this user.
  
Return eprints currently in the editorial review buffer. If this userhas editperms set then only return those records which match.
+
<tt>%opts</tt> is passed to a [[API:EPrints/Search|EPrints::Search]], which is used to filter  the results.  
Since 2.4 this returns an EPrints::List object, not an array of eprints.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_owned_eprints -->==get_owned_eprints==
 
  
  $list = $user-&gt;get_owned_eprints( $dataset );
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Return a list of the eprints which this user owns. This is by defaultthe same as $user-&gt;get_eprints( $dataset) but may be over-ridden byget_users_owned_eprints.
 
Since 2.4 this returns an EPrints::List object, not an array of eprints.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_has_owner -->==has_owner==
 
  
  $boolean = $user-&gt;has_owner( $possible_owner )
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_editable_eprints_list -->
 +
====editable_eprints_list====
  
True if the users are the same record.
+
$list = $user-&gt;editable_eprints_list( %opts )
<!-- End of Pod2Wiki -->
+
Returns a [[API:EPrints/List|EPrints::List]] of [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]]s that match  this user's editorial search expressions. If the user has no editorial  scope a list of all eprints that match the given <tt>%opts</tt> is returned.
<!-- Pod2Wiki=item_mail -->==mail==
 
  
  $ok = $user-&gt;mail( $subjectid, $message, [$replyto], [$email] )
+
<tt>%opts</tt> is passed to a [[API:EPrints/Search|EPrints::Search]] which is used to filter the  results.
  
 +
$list = $user-&gt;editable_eprints_list(
 +
    dataset =&gt; $repo-&gt;dataset( "buffer" ),
 +
);
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_has_owner -->
 +
====has_owner====
 +
 +
$boolean = $user-&gt;has_owner( $possible_owner )
 +
Returns <tt>true</tt> if <tt>$possible_owner</tt> is the same as this user.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_mail -->
 +
====mail====
 +
 +
$ok = $user-&gt;mail( $subjectid, $message, [$replyto, $email, $cc_list] )
 
Send an email to this user.  
 
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 therepository default.
 
$email is the email address to send this email to if different fromthis users configured email address.
 
Return true if the email was sent OK.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_render -->==render==
 
  
  ( $page, $title ) = $user-&gt;render
+
<tt>$subjectid</tt> is the ID of a phrase to use as the subject of this  email.
 +
 
 +
<tt>$message</tt> is an XML DOM object describing the message in simple  XHTML.
 +
 
 +
<tt>$replyto</tt> is the reply to address for this email, if different to  the repository default.
 +
 
 +
<tt>$email</tt> is the email address to send this email to if different from this users configured email address.
 +
 
 +
<tt>$cc_list</tt> is an optional CC list (array reference)
 +
 
 +
Returns <tt>true</tt> if the email was sent OK.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render -->
 +
====render====
 +
 
 +
( $page, $title ) = $user-&gt;render
 +
Returns XHTML DOM renderings of the page and the title for this user's page. This uses the configurable <tt>$user_render</tt> method that can  typically be found in <tt>cfg.d/user_render.pl</tt>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_render_full -->
 +
====render_full====
 +
 
 +
( $page, $title ) = $user-&gt;render_full
 +
The same as [[API:EPrints/DataObj/User#render|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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_url -->
 +
====get_url====
 +
 
 +
$url = $user-&gt;get_url
 +
Returns the URL which will display information about this user.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_control_url -->
 +
====get_control_url====
 +
 
 +
$url = $dataobj-&gt;get_control_url
 +
Returns the URL for the control page for this user.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_type -->
 +
====get_type====
 +
 
 +
$type = $user-&gt;get_type
 +
Return the type of this user.
 +
 
 +
Alias for:
 +
 
 +
$user-&gt;get_value( "usertype" )
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_saved_searches -->
 +
====get_saved_searches====
 +
 
 +
@saved_searches = $eprint-&gt;get_saved_searches
 +
Returns an array of all {{API:PodLink|file=EPrint/DataObj/SavedSearch|package_name=EPrint::DataObj::SavedSearch|section=|text=EPrint::DataObj::SavedSearch}} objects  associated with this user.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_preference -->
 +
====preference====
 +
 
 +
$value = $user-&gt;preference( $key )
 +
Returns the preference value for <tt>$key</tt>. Otherwise, returns <tt>undef</tt>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_set_preference -->
 +
====set_preference====
 +
 
 +
$user-&gt;set_preference( $key, $value )
 +
Set a preference <tt>$key</tt> to <tt>$value</tt> for this user.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_send_out_editor_alert -->
 +
====send_out_editor_alert====
 +
 
 +
$user-&gt;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. Typically called  by [[API:EPrints/DataObj/User#process_editor_alerts|process_editor_alerts]].
 +
 
 +
Only sends the email if needed.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_allow -->
 +
====allow====
 +
 
 +
$result = $user-&gt;allow( $priv, [ $item ] )
 +
Returns <tt>true</tt> if user can perform an action specified by <tt>$priv</tt>.
 +
 
 +
If set, further checks whether the user is permitted to perform the action of <tt>$priv</tt> on a particular <tt>$item</tt> data object.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_has_privilege -->
 +
====has_privilege====
 +
 
 +
$boolean = $user-&gt;has_privilege( $priv )
 +
Returns <tt>true</tt> if <tt>$priv</tt> is in the user's privileges list.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_privs -->
 +
====get_privs====
 +
 
 +
$privs = $user-&gt;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.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get_roles -->
 +
====get_roles====
 +
 
 +
@roles = $user-&gt;get_roles;
 +
Returns the roles this user has. Each role represents a whole bunch of privileges.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_has_role -->
 +
====has_role====
 +
 
 +
$user-&gt;has_role( $roleid )
 +
Returns boolean dependent on whether this user has the role <tt>$roleid</tt>.
  
Render this user into HTML using the "user_render" method inArchiveRenderConfig.pm. Returns both the rendered information andthe title as XHTML DOM.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=item_render_full -->==render_full==
+
<!-- Edit below this comment -->
  
  ( $page, $title ) = $user-&gt;render_full
 
  
The same as $user-&gt;render, but renders all fields, not just those intended for public viewing. This is the admin view of the user.
+
<!-- Pod2Wiki= -->
<!-- End of Pod2Wiki -->
+
</div>
<!-- Pod2Wiki=item_get_url -->==get_url==
+
<!-- Pod2Wiki=head_utility_methods -->
 +
===Utility Methods===
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
  $url = $user-&gt;get_url
 
  
Return the URL which will display information about this user.
+
<!-- Pod2Wiki= -->
If $staff is true then return the URL for an administrator to viewand modify this record.
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_user_with_email -->
<!-- Pod2Wiki=item_get_type -->==get_type==
+
====user_with_email====
  
  $type = $user-&gt;get_type
+
$user = EPrints::DataObj::User::user_with_email( $repo, $email )
 +
Returns the use with the specified <tt>$email</tt>, or <tt>undef</tt> if they cannot benot found.
  
Return the type of this user. Equivalent of $user-&gt;get_value( "usertype" );
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- End of Pod2Wiki -->
+
<span style='display:none'>User Comments</span>
<!-- Pod2Wiki=item_get_saved_searches -->==get_saved_searches==
+
<!-- Edit below this comment -->
  
  @saved_searches = $eprint-&gt;get_saved_searches
 
  
Return an array of all EPrint::DataObj::SavedSearch objects associated with thisuser.
+
<!-- Pod2Wiki= -->
<!-- End of Pod2Wiki -->
+
</div>
<!-- Pod2Wiki=item_send_out_editor_alert -->==send_out_editor_alert==
+
<!-- Pod2Wiki=item_user_with_username -->
 +
====user_with_username====
  
  $user-&gt;send_out_editor_alert
+
$user = EPrints::DataObj::User::user_with_username( $session, $username )
 +
Returns the user with the specified <tt>$username</tt>, or <tt>undef</tt> if they cannot be not found.
  
Called on users who are editors, when it's time to send their updateon what items are in the editorial review buffer.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Sends the email if needed.
+
<span style='display:none'>User Comments</span>
<!-- End of Pod2Wiki -->
+
<!-- Edit below this comment -->
<!-- Pod2Wiki=item_process_editor_alerts -->==process_editor_alerts==
 
  
  EPrints::DataObj::User::process_editor_alerts( $session, $frequency );
 
  
Static method.
+
<!-- Pod2Wiki= -->
Called to send out all editor alerts of a given frequency (daily,weekly, monthly) for the current repository.
+
</div>
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki=item_process_editor_alerts -->
<!-- Pod2Wiki=item_allow -->==allow==
+
====process_editor_alerts====
  
  $result = $user-&gt;allow( $priv, [$item] )
+
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 <tt>bin/send_alerts</tt> script that is configured as daily, weekly and monthly cron jobs.
  
Returns true if $user can perform this action/view this screen.
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
A true result is 1..15 where the value indicates what about the userallowed the priv to be performed. This is used for filtering owner/editor actions in eprint control screens.
+
<span style='display:none'>User Comments</span>
1 = anybody (not currently used)2 = only if logged in 4 = only if owner of item8 = only if editor of item
+
<!-- Edit below this comment -->
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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_undocumented_methods -->=UNDOCUMENTED METHODS=
 
{{API:Undocumented Methods}}<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_can_edit -->==can_edit==
 
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_create -->==create==
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_create_from_data -->==create_from_data==
+
</div>
 +
<!-- Pod2Wiki=head_see_also -->
 +
==SEE ALSO==
 +
[[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|EPrints::DataSet]].
  
<!-- End of Pod2Wiki -->
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
<!-- Pod2Wiki=item_get_control_url -->==get_control_url==
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_privs -->==get_privs==
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=item_get_roles -->==get_roles==
+
</div>
 +
<!-- Pod2Wiki=head_copyright -->
 +
==COPYRIGHT==
 +
{{API:Copyright}}
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_has_role -->==has_role==
 
  
<!-- End of Pod2Wiki -->
+
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
+
</div>
 +
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Latest revision as of 18:50, 10 January 2022

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::User - Class representing a single user.

User Comments


DESCRIPTION

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.

User Comments


CORE METADATA FIELDS

User Comments


userid (int)

The unique ID number of this user record. Unique within the current repository.

User Comments


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.

User Comments


username (text)

The username of this user. Used for logging into the system. Unique within this repository.

User Comments


password (secret)

The crypted password for this user as generated by EPrints::Utils/crypt. This may be ignored if for example LDAP authentication is being used.

User Comments


usertype (namedset)

The type of this user. The options are configured in metadata-phrases.xml.

User Comments


newemail (email)

Used to store a new but as yet unconfirmed email address.

User Comments


newpassword (secret)

Used to store a new but as yet unconfirmed password.

User Comments


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.

User Comments


pinsettime (int)

When the pin code was set, so we can make it time out.

User Comments


loginattempts (int)

Number of login attempts since last successful login.

User Comments


unlocktime (int)

Time at which user account will be unlocked after too many failed login attempts.

User Comments


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.

User Comments


email (email)

The email address of this user. Unique within the repository.

User Comments


lang (arclanguage)

The ID of the prefered language of this user. Only really used in multilingual repositories.

User Comments


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.

User Comments


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.

User Comments


mailempty (boolean)

Only relevant to staff accounts. If set to true then emails are sent even if there are no items matching the scope.

User Comments


latitude (float)

The latitude of the location where the user is based.

User Comments


longitude (float)

The longitude of the location where the user is based.

User Comments


preference (storable)

User preferences which need to be persistent. Stored as a serialization of simple key-value pairs.

User Comments


captcha (recaptcha)

A ReCAPTCHA field to use to protect user password resets and similar forms from being spammed.

User Comments


REFERENCES AND RELATED OBJECTS

User Comments


saved_searches (subobject, multiple)

Saved searches created by this user.

User Comments


item_fields (fields, multiple)

Stores bespoke metafields created by this user and stored in the database.

User Comments


INSTANCE VARIABLES

See EPrints::DataObj.

User Comments


METHODS

User Comments


Constructor Methods

User Comments


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.

User Comments


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.

User Comments


create

$user = EPrints::DataObj::User::create( $session, $user_type ) 

Create a new user in the database with the specified user type.

User Comments


create_from_data

$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.

User Comments


Class Methods

User Comments


get_system_field_info

$fields = EPrints::DataObj::User->get_system_field_info

Returns an array describing the system metadata of the the user dataset.

User Comments


get_dataset_id

$dataset = EPrints::DataObj::User->get_dataset_id

Returns the ID of the EPrints::DataSet object to which this record belongs.

User Comments


Object Methods

User Comments


validate

$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.

User Comments


commit

$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.

User Comments


close_non_current_login_tickets

$user->close_non_current_login_tickets

Close all login tickets for this user except the one they are currently logged in on.

User Comments


remove

$success = $user->remove

Remove this user from the database. Also, remove their saved searches, but do not remove their eprints.

User Comments


is_staff

$bool = $user->is_staff

Returns true if the user has_role is editor or admin.

User Comments


language

$lang = $user->language

Get the preferred language of this user.

User Comments


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.

User Comments


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 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" ),
);
 

User Comments


has_owner

$boolean = $user->has_owner( $possible_owner )

Returns true if $possible_owner is the same as this user.

User Comments


mail

$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.

User Comments


render

( $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.

User Comments


render_full

( $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.

User Comments


get_url

$url = $user->get_url

Returns the URL which will display information about this user.

User Comments


get_control_url

$url = $dataobj->get_control_url

Returns the URL for the control page for this user.

User Comments


get_type

$type = $user->get_type

Return the type of this user.

Alias for:

$user->get_value( "usertype" )
 

User Comments


get_saved_searches

@saved_searches = $eprint->get_saved_searches

Returns an array of all EPrint::DataObj::SavedSearch objects associated with this user.

User Comments


preference

$value = $user->preference( $key )

Returns the preference value for $key. Otherwise, returns undef.

User Comments


set_preference

$user->set_preference( $key, $value )

Set a preference $key to $value for this user.

User Comments


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. Typically called by process_editor_alerts.

Only sends the email if needed.

User Comments


allow

$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.

User Comments


has_privilege

$boolean = $user->has_privilege( $priv )

Returns true if $priv is in the user's privileges list.

User Comments


get_privs

$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.

User Comments


get_roles

@roles = $user->get_roles;

Returns the roles this user has. Each role represents a whole bunch of privileges.

User Comments


has_role

$user->has_role( $roleid )

Returns boolean dependent on whether this user has the role $roleid.

User Comments


Utility Methods

User Comments


user_with_email

$user = EPrints::DataObj::User::user_with_email( $repo, $email )

Returns the use with the specified $email, or undef if they cannot benot found.

User Comments


user_with_username

$user = EPrints::DataObj::User::user_with_username( $session, $username )

Returns the user with the specified $username, or undef if they cannot be not found.

User Comments


process_editor_alerts

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.

User Comments


SEE ALSO

EPrints::DataObj and EPrints::DataSet.

User Comments


COPYRIGHT

© Copyright 2000-2024 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE

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/.

User Comments