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

From EPrints Documentation
Jump to: navigation, search
(New page: <!-- 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. -...)
 
(Removing all content from page)
 
Line 1: Line 1:
<!-- 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.
 
-->[[Category:API]]<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_name -->=NAME=
 
'''EPrints::DataObj::User''' - Class representing a single user.
 
<!-- 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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_rev_number -->==rev_number==
 
 
  rev_number (int)
 
 
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)
 
 
The username of this user. Used for logging into the system. Unique withinthis repository.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_password -->==password==
 
 
  password (secret)
 
 
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)
 
 
The type of this user. The options are configured in metadata-phrases.xml.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_newemail -->==newemail==
 
 
  newemail (email)
 
 
Used to store a new but as yet unconfirmed email address.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_newpassword -->==newpassword==
 
 
  newpassword (secret)
 
 
Used to store a new but as yet unconfirmed password.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_pin -->==pin==
 
 
  pin (text)
 
 
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)
 
 
When the pin code was set, so we can make it time out.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_joined -->==joined==
 
 
  joined (time)
 
 
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)
 
 
The email address of this user. Unique within the repository.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_lang -->==lang==
 
 
  lang (namedset)
 
 
The ID of the prefered language of this user. Only really used in multilingualrepositories.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_editperms -->==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. butif it is set then an eprint must match at least one of the searches to bewithin their scope.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_frequency -->==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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_mailempty -->==mailempty==
 
 
  mailempty (boolean)
 
 
Only relevant to staff accounts. If set to true then emails are senteven if there are no items matching the scope.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=head_methods -->=METHODS=
 
<!-- 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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_new -->==new==
 
 
  $user = EPrints::DataObj::User-&gt;new( $session, $userid )
 
 
Load the user with the ID of $userid from the database and returnit as an EPrints::DataObj::User object.
 
<!-- End of Pod2Wiki -->
 
<!-- 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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_dataset_id -->==get_dataset_id==
 
 
  $dataset = EPrints::DataObj::User-&gt;get_dataset_id
 
 
Returns the id of the [[API_EPrints/DataSet]] object to which this record belongs.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_defaults -->==get_defaults==
 
 
  $defaults = EPrints::DataObj::User-&gt;get_defaults( $session, $data )
 
 
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 )
 
 
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 )
 
 
Return the EPrints::user with the specified $username, or undef if they are not found.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_validate -->==validate==
 
 
  $problems = $thing-&gt;validate
 
 
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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_commit -->==commit==
 
 
  $user-&gt;commit( [$force] )
 
 
Write this object to the database.
 
If $force isn't true then it only actually modifies the databaseif one or more fields have been changed.
 
<!-- End of Pod2Wiki -->
 
<!-- 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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_eprints -->==get_eprints==
 
 
  $list = $user-&gt;get_eprints( $dataset )
 
 
Return EPrints in the given EPrints::DataSet which have this useras their creator.
 
Since 2.4 this returns an EPrints::List object, not an array of eprints.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_editable_eprints -->==get_editable_eprints==
 
 
  $list = $user-&gt;get_editable_eprints
 
 
Return eprints currently in the editorial review buffer. If this userhas editperms set then only return those records which match.
 
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 );
 
 
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 )
 
 
True if the users are the same record.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_mail -->==mail==
 
 
  $ok = $user-&gt;mail( $subjectid, $message, [$replyto], [$email] )
 
 
Send an email to this user.
 
$subjectid is the ID of a phrase to use as the subject of this email.
 
$message is an XML DOM object describing the message in simple XHTML.
 
$replyto is the reply to address for this email, if different to 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
 
 
Render this user into HTML using the "user_render" method inArchiveRenderConfig.pm. Returns both the rendered information andthe title as XHTML DOM.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_render_full -->==render_full==
 
 
  ( $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.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_url -->==get_url==
 
 
  $url = $user-&gt;get_url
 
 
Return the URL which will display information about this user.
 
If $staff is true then return the URL for an administrator to viewand modify this record.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_type -->==get_type==
 
 
  $type = $user-&gt;get_type
 
 
Return the type of this user. Equivalent of $user-&gt;get_value( "usertype" );
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_get_saved_searches -->==get_saved_searches==
 
 
  @saved_searches = $eprint-&gt;get_saved_searches
 
 
Return an array of all EPrint::DataObj::SavedSearch objects associated with thisuser.
 
<!-- End of Pod2Wiki -->
 
<!-- 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 updateon what items are in the editorial review buffer.
 
Sends the email if needed.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_process_editor_alerts -->==process_editor_alerts==
 
 
  EPrints::DataObj::User::process_editor_alerts( $session, $frequency );
 
 
Static method.
 
Called to send out all editor alerts of a given frequency (daily,weekly, monthly) for the current repository.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=item_allow -->==allow==
 
 
  $result = $user-&gt;allow( $priv, [$item] )
 
 
Returns true if $user can perform this action/view this screen.
 
A true result is 1..15 where the value indicates what about the userallowed the priv to be performed. This is used for filtering owner/editor actions in eprint control screens.
 
1 = anybody (not currently used)2 = only if logged in 4 = only if owner of item8 = only if editor of item
 
For non item related privs the result will normally be 2.
 
Nb. That create eprint is NOT a priv related to an eprint, as you don't own it at that stage.
 
<!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
 

Latest revision as of 16:30, 10 August 2009