EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09668
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Limit user create new item
- To: <eprints-tech@ecs.soton.ac.uk>, Agung Prasetyo W. <prazetyo@gmail.com>
- Subject: Re: [EP-tech] Limit user create new item
- From: David R Newman <drn@ecs.soton.ac.uk>
- Date: Thu, 7 Mar 2024 10:29:57 +0000
Hi Agung,
I think you can implement a "soft" restriction, which just removes the "New Item" button on the "Manage Deposits" page. However, this would still allow new items to be created from Import or by using the "New Version" button under an item they has already created. So you may want to use a similar approach to as below disable those buttons.
Create a file in your local archive called cfg/plugins/EPrints/Plugin/Screen/LocalNewEPrint.pm with the following code:
package
EPrints::Plugin::Screen::LocalNewEPrint;
use EPrints::Plugin::Screen::NewEPrint;
our @ISA = qw/ EPrints::Plugin::Screen::NewEPrint /;
sub allow_create
{
my ( $self ) = @_;
my $user = $self->{session}->current_user;
if ( $user->get_value( 'usertype' ) eq "user" &&
$user->owned_eprints_list->count >= 2 )
{
return 0;
}
return $self->allow( "create_eprint" );
}
1;
$c->{plugin_alias_map}->{"Screen::LocalNewEPrint"} = undef;
CAUTION: This e-mail originated outside the University of Southampton.CAUTION: This e-mail originated outside the University of Southampton.Hi,
Is it possible to limit creating new items per user to only 2 times. If there is, please tell me how to do it.
Thank you.
Regards,Agung PW
*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List *** Archive: https://www.eprints.org/tech.php/ *** EPrints community wiki: https://wiki.eprints.org/
- Follow-Ups:
- Re: [EP-tech] Limit user create new item
- From: "Agung Prasetyo W." <prazetyo@gmail.com>
- Re: [EP-tech] Limit user create new item
- References:
- [EP-tech] Limit user create new item
- From: "Agung Prasetyo W." <prazetyo@gmail.com>
- [EP-tech] Limit user create new item
- Prev by Date: [EP-tech] CAS configuration
- Next by Date: Re: [EP-tech] Limit user create new item
- Previous by thread: [EP-tech] Limit user create new item
- Next by thread: Re: [EP-tech] Limit user create new item
- Index(es):