User validate.pl

From EPrints Documentation
Jump to: navigation, search

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


Back to cfg.d

user_validate.pl contains configuration for validating User data objects.

The validate_user function tests the validity of the values set for the metadata fields for a User. This usually happens when a user submits the form (e.g. clicks on Previous, Save and Return or Next) on the Upload stage.

  • $user is the User object being validated.
  • $repository is a Repository object.
  • $for_archive is a boolean indicating whether the current validation is a precursor to the item being moved to the live archive. Its value make no difference for the default validate_user function.

Example

In this example, there are no specific validation checks, which is the default but the # CHECKS IN HERE is where any validation checks should be inserted.

$c->{validate_user} = sub
{
    my( $user, $repository, $for_archive ) = @_;
 
    my @problems = ();
 
    # CHECKS IN HERE
 
    return( @problems );
};