Miscellaneous Config Options/get users owned eprints

From EPrints Documentation
Revision as of 14:22, 26 July 2024 by Drn@ecs.soton.ac.uk (talk | contribs) (Added example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Example

$c->{get_users_owned_eprints} = sub 
{
    my( $session, $user, %opts ) = @_;
    # for non-editorial accounts, return the normal list
    if( $user->get_type ne "editor" )
    {
        return $user->owned_eprints_list_actual( %opts );
    }
    # only interested in editor accounts now
    # allow editors to see their items, and items from a specific userid e.g. 99999
    my $extra_userid = 99999;
    my $searchexp = $opts{dataset}->prepare_search( %opts );
    $searchexp->add_field( $opts{dataset}->field( "userid" ), $user->id . " $extra_userid", "IN", "ANY" );
    return $searchexp->perform_search;
};