Difference between revisions of "API:EPrints/DataObj/User"
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Pod2Wiki=_preamble_ | <!-- Pod2Wiki=_preamble_ | ||
− | This page has been automatically generated from the EPrints 3. | + | 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}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/User.pm|package_name=EPrints::DataObj::User}}[[Category:API|USER]][[Category:API:EPrints/DataObj | + | -->{{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 --> |
Line 19: | Line 19: | ||
This class represents a single eprint user record and the metadata associated with it. | This class represents a single eprint user record and the metadata associated with it. | ||
− | + | 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>. | |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 28: | Line 28: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- 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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 40: | Line 40: | ||
===userid (int)=== | ===userid (int)=== | ||
− | The unique ID number of this user record. Unique within the current repository. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 52: | Line 52: | ||
===rev_number (int)=== | ===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. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 64: | Line 64: | ||
===username (text)=== | ===username (text)=== | ||
− | The username of this user. Used for logging into the system. Unique within this repository. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 76: | Line 76: | ||
===password (secret)=== | ===password (secret)=== | ||
− | The password | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 88: | Line 88: | ||
===usertype (namedset)=== | ===usertype (namedset)=== | ||
− | The type of this user. The options are configured in metadata-phrases.xml. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 124: | Line 124: | ||
===pin (text)=== | ===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. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 137: | Line 137: | ||
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. | ||
+ | |||
+ | <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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 148: | Line 172: | ||
===joined (time)=== | ===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 | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 170: | Line 194: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_lang --> | <!-- Pod2Wiki=item_lang --> | ||
− | ===lang ( | + | ===lang (arclanguage) === |
− | The ID of the prefered language of this user. Only really used in multilingual repositories. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 184: | Line 208: | ||
===editperms (search, multiple)=== | ===editperms (search, multiple)=== | ||
− | This field is used to filter what eprints a staff member can approve and | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 196: | Line 220: | ||
===frequency (set)=== | ===frequency (set)=== | ||
− | Only relevant to staff accounts. Is the frequency they want to be mailed | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 208: | Line 232: | ||
===mailempty (boolean)=== | ===mailempty (boolean)=== | ||
− | Only relevant to staff accounts. If set to true then emails are sent even if there are no items matching the scope. | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 218: | Line 266: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_preference --> | <!-- Pod2Wiki=item_preference --> | ||
− | ===preference ( | + | ===preference (storable)=== |
− | User preferences which need to be persistent | + | 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. | ||
+ | |||
+ | <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_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 --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_saved_searches --> | ||
+ | ===saved_searches (subobject, multiple)=== | ||
+ | |||
+ | Saved searches created by 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_item_fields --> | ||
+ | ===item_fields (fields, multiple)=== | ||
+ | |||
+ | Stores bespoke metafields created by this user and stored in the database. | ||
+ | |||
+ | <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_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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 238: | Line 342: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- 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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 252: | Line 352: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_new --> | <!-- Pod2Wiki=item_new --> | ||
− | ===new=== | + | ====new==== |
$user = EPrints::DataObj::User->new( $session, $userid ) | $user = EPrints::DataObj::User->new( $session, $userid ) | ||
Line 265: | Line 365: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_new_from_data --> | <!-- Pod2Wiki=item_new_from_data --> | ||
− | ===new_from_data=== | + | ====new_from_data==== |
$user = EPrints::DataObj::User->new_from_data( $session, $data ) | $user = EPrints::DataObj::User->new_from_data( $session, $data ) | ||
Line 279: | Line 379: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- 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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 292: | Line 392: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_create_from_data --> |
− | === | + | ====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. | ||
+ | |||
+ | <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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 305: | Line 418: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_get_system_field_info --> |
− | === | + | ====get_system_field_info==== |
− | $ | + | $fields = EPrints::DataObj::User->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 318: | Line 431: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_get_dataset_id --> |
− | === | + | ====get_dataset_id==== |
+ | |||
+ | $dataset = EPrints::DataObj::User->get_dataset_id | ||
+ | Returns the ID of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs. | ||
+ | |||
+ | <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_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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 332: | Line 454: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_validate --> | <!-- Pod2Wiki=item_validate --> | ||
− | ===validate=== | + | ====validate==== |
− | $problems = $ | + | $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. | 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 | + | If there are no problems then the array is empty. |
The problems are XHTML DOM objects describing the problem. | The problems are XHTML DOM objects describing the problem. | ||
Line 349: | Line 471: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_commit --> | <!-- Pod2Wiki=item_commit --> | ||
− | ===commit=== | + | ====commit==== |
− | $user->commit( [$force] ) | + | $success = $user->commit( [ $force ] ) |
− | + | Writes this user data object to the database. | |
− | If $force | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 363: | Line 487: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_close_non_current_login_tickets --> |
− | === | + | ====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. | |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 376: | Line 500: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_remove --> |
− | === | + | ====remove==== |
− | $ | + | $success = $user->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 391: | Line 513: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_is_staff --> |
− | === | + | ====is_staff==== |
− | |||
− | |||
− | |||
− | + | $bool = $user->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 406: | Line 526: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_language --> |
− | === | + | ====language==== |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | $lang = $user->language | |
+ | Get the preferred language of 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 423: | Line 539: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_owned_eprints_list --> |
− | === | + | ====owned_eprints_list==== |
− | $list = $user-> | + | $list = $user->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. | |
− | + | <tt>%opts</tt> is passed to a [[API:EPrints/Search|EPrints::Search]], which is used to filter the results. | |
− | |||
− | |||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 440: | Line 554: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_editable_eprints_list --> |
− | === | + | ====editable_eprints_list==== |
− | $list = $user-> | + | $list = $user->editable_eprints_list( %opts ) |
− | + | 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. | |
− | |||
− | |||
− | + | <tt>%opts</tt> is passed to a [[API:EPrints/Search|EPrints::Search]] which is used to filter the results. | |
+ | $list = $user->editable_eprints_list( | ||
+ | dataset => $repo->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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 458: | Line 574: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_has_owner --> | <!-- Pod2Wiki=item_has_owner --> | ||
− | ===has_owner=== | + | ====has_owner==== |
$boolean = $user->has_owner( $possible_owner ) | $boolean = $user->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 471: | Line 587: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_mail --> | <!-- Pod2Wiki=item_mail --> | ||
− | ===mail=== | + | ====mail==== |
− | $ok = $user->mail( $subjectid, $message, [$replyto | + | $ok = $user->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. | + | <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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 494: | Line 612: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_render --> | <!-- Pod2Wiki=item_render --> | ||
− | ===render=== | + | ====render==== |
( $page, $title ) = $user->render | ( $page, $title ) = $user->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 507: | Line 625: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_render_full --> | <!-- Pod2Wiki=item_render_full --> | ||
− | ===render_full=== | + | ====render_full==== |
( $page, $title ) = $user->render_full | ( $page, $title ) = $user->render_full | ||
− | The same as | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 520: | Line 638: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_get_url --> | <!-- Pod2Wiki=item_get_url --> | ||
− | ===get_url=== | + | ====get_url==== |
$url = $user->get_url | $url = $user->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->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 535: | Line 664: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_get_type --> | <!-- Pod2Wiki=item_get_type --> | ||
− | ===get_type=== | + | ====get_type==== |
$type = $user->get_type | $type = $user->get_type | ||
− | Return the type of this user. | + | Return the type of this user. |
+ | Alias for: | ||
+ | |||
+ | $user->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%; '> | <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> | <span style='display:none'>User Comments</span> | ||
Line 548: | Line 681: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_get_saved_searches --> | <!-- Pod2Wiki=item_get_saved_searches --> | ||
− | ===get_saved_searches=== | + | ====get_saved_searches==== |
@saved_searches = $eprint->get_saved_searches | @saved_searches = $eprint->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 561: | Line 694: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_preference --> | <!-- Pod2Wiki=item_preference --> | ||
− | ===preference=== | + | ====preference==== |
$value = $user->preference( $key ) | $value = $user->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 574: | Line 707: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_set_preference --> | <!-- Pod2Wiki=item_set_preference --> | ||
− | ===set_preference=== | + | ====set_preference==== |
$user->set_preference( $key, $value ) | $user->set_preference( $key, $value ) | ||
− | Set a preference $key | + | 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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 587: | Line 720: | ||
</div> | </div> | ||
<!-- Pod2Wiki=item_send_out_editor_alert --> | <!-- Pod2Wiki=item_send_out_editor_alert --> | ||
− | ===send_out_editor_alert=== | + | ====send_out_editor_alert==== |
$user->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. | + | 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->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->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->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->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%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 601: | Line 790: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_has_role --> |
− | === | + | ====has_role==== |
+ | |||
+ | $user->has_role( $roleid ) | ||
+ | Returns boolean dependent on whether this user has the role <tt>$roleid</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=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 --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_user_with_email --> | ||
+ | ====user_with_email==== | ||
+ | |||
+ | $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. | ||
+ | |||
+ | <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_user_with_username --> | ||
+ | ====user_with_username==== | ||
− | + | $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. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 616: | Line 838: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_process_editor_alerts --> |
− | === | + | ====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 <tt>bin/send_alerts</tt> script that is configured as daily, weekly and monthly cron jobs. | |
− | + | <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_see_also --> | ||
+ | ==SEE ALSO== | ||
+ | [[API:EPrints/DataObj|EPrints::DataObj]] and [[API:EPrints/DataSet|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 --> | ||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </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%; '> | <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> | <span style='display:none'>User Comments</span> |
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
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 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 INSTANCE VARIABLES
- 6 METHODS
- 6.1 Constructor Methods
- 6.2 Class Methods
- 6.3 Object Methods
- 6.3.1 validate
- 6.3.2 commit
- 6.3.3 close_non_current_login_tickets
- 6.3.4 remove
- 6.3.5 is_staff
- 6.3.6 language
- 6.3.7 owned_eprints_list
- 6.3.8 editable_eprints_list
- 6.3.9 has_owner
- 6.3.10 mail
- 6.3.11 render
- 6.3.12 render_full
- 6.3.13 get_url
- 6.3.14 get_control_url
- 6.3.15 get_type
- 6.3.16 get_saved_searches
- 6.3.17 preference
- 6.3.18 set_preference
- 6.3.19 send_out_editor_alert
- 6.3.20 allow
- 6.3.21 has_privilege
- 6.3.22 get_privs
- 6.3.23 get_roles
- 6.3.24 has_role
- 6.4 Utility Methods
- 7 SEE ALSO
- 8 COPYRIGHT
NAME
EPrints::DataObj::User - Class representing a single user.
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.
CORE METADATA FIELDS
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 crypted password for this user as generated by EPrints::Utils/crypt. This may be ignored if for example LDAP authentication is being used.
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.
loginattempts (int)
Number of login attempts since last successful login.
unlocktime (int)
Time at which user account will be unlocked after too many failed login attempts.
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 (arclanguage)
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.
latitude (float)
The latitude of the location where the user is based.
longitude (float)
The longitude of the location where the user is based.
preference (storable)
User preferences which need to be persistent. Stored as a serialization of simple key-value pairs.
captcha (recaptcha)
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.
INSTANCE VARIABLES
See EPrints::DataObj.
METHODS
Constructor Methods
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.
create
$user = EPrints::DataObj::User::create( $session, $user_type )
Create a new user in the database with the specified user type.
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.
Class Methods
get_system_field_info
$fields = EPrints::DataObj::User->get_system_field_info
Returns an array describing the system metadata of the the user dataset.
get_dataset_id
$dataset = EPrints::DataObj::User->get_dataset_id
Returns the ID of the EPrints::DataSet object to which this record belongs.
Object Methods
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.
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.
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.
remove
$success = $user->remove
Remove this user from the database. Also, remove their saved searches, but do not remove their eprints.
is_staff
$bool = $user->is_staff
Returns true if the user has_role is editor or admin.
language
$lang = $user->language
Get the preferred language of this 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 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" ), );
has_owner
$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.
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.
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.
get_url
$url = $user->get_url
Returns the URL which will display information about this user.
get_control_url
$url = $dataobj->get_control_url
Returns the URL for the control page for this user.
get_type
$type = $user->get_type
Return the type of this user.
Alias for:
$user->get_value( "usertype" )
get_saved_searches
@saved_searches = $eprint->get_saved_searches
Returns an array of all EPrint::DataObj::SavedSearch objects associated with this user.
preference
$value = $user->preference( $key )
Returns the preference value for $key. Otherwise, returns undef.
set_preference
$user->set_preference( $key, $value )
Set a preference $key to $value for this user.
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.
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.
has_privilege
$boolean = $user->has_privilege( $priv )
Returns true if $priv is in the user's privileges list.
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.
get_roles
@roles = $user->get_roles;
Returns the roles this user has. Each role represents a whole bunch of privileges.
has_role
$user->has_role( $roleid )
Returns boolean dependent on whether this user has the role $roleid.
Utility Methods
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_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.
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.
SEE ALSO
EPrints::DataObj and EPrints::DataSet.
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/.