EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #10320
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Custom Error Message for Screen Access / IRStats
- To: Tomasz Neugebauer <Tomasz.Neugebauer@concordia.ca>, "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Custom Error Message for Screen Access / IRStats
- From: David R Newman <drn@ecs.soton.ac.uk>
- Date: Thu, 22 Jan 2026 17:02:36 +0000
Hi Tomasz,
Customising this message is not straightforward as this message comes from the screen processor which is quite low level in the codebase. I assume when you are talking about a "user" you mean a visitor to your repository who is not logged in. Therefore, the best option is to edit IRStats2 cgi/stats report script. This looks something like:
use EPrints;
use EPrints::ScreenProcessor;
use strict;
my $session = EPrints::Session->new();
exit( 0 ) unless( defined $session );
EPrints::ScreenProcessor->process(
session => $session,
screenid => "IRStats2::Report",
);
$session->terminate;
If you put some code before the EPrints::ScreenProcessor line
that checks if the is a currently logged in user. You could then
redirect the user to a static page to warn the user they need to
be logged in to have access. There are other approaches but I
think this requires only a minimal change to the codebase and a
stand-alone static page that cannot interfere with anything else.
Regards
David Newman
CAUTION: This e-mail originated outside the University of Southampton.Hi everyone,
I'm in the process of putting IRStats2 behind a login, and it's going well, but I've had nothing but failure in my attempts to customize the error message that the user receives when they attempt to access the stats without logging in. Right now, after adding specific permissions for IRStats, something ike this:
push @{$c->{user_roles}->{user}}, "+irstats2/view";
push @{$c->{user_roles}->{user}}, "+irstats2/export";
and a custom $c->{irstats2}->{allow} = sub for IRStats, we can control the access, but the default error message when a user attempts to view the stats is not ideal, it's just the default:
Error: You may not view this screen: IRStats2::Report.
I would like to customize this message to say something informative (referring to a "screen" here is not exactly user friendly) for example, "Access to statistics is restricted to logged in users."
I have tried so many different ways to get that custom message to display, and nothing has worked!
I know that IRStats2 code has been updated recently, without a push to the bazaar, so I'm not entirely sure just how up-to-date our code is for that. I've been waiting for the bazaar version of the plugin, but perhaps that's not the best strategy. I doubt that this is addressed in any of those recent commits, but let me know if it is.
Tomasz
________________________________________________
Tomasz Neugebauer
Senior Librarian | Bibliothécaire titulaire
Digital Projects & Systems Development Librarian / Bibliothécaire des Projets Numériques & Développement de Systèmes
Concordia University / Université ConcordiaTel. / Tél. 514-848-2424 ext. / poste 7738
Email / courriel: tomasz.neugebauer@concordia.caMailing address / adresse postale: 1455 De Maisonneuve Blvd. W., LB-540-03, Montreal, Quebec H3G 1M8
Street address / adresse municipale: 1400 De Maisonneuve Blvd. W., LB-540-03, Montreal, Quebec H3G 1M8library.concordia.ca
- Follow-Ups:
- RE: [EP-tech] Custom Error Message for Screen Access / IRStats
- From: John Salter <J.Salter@leeds.ac.uk>
- RE: [EP-tech] Custom Error Message for Screen Access / IRStats
- References:
- [EP-tech] Custom Error Message for Screen Access / IRStats
- From: Tomasz Neugebauer <Tomasz.Neugebauer@concordia.ca>
- [EP-tech] Custom Error Message for Screen Access / IRStats
- Prev by Date: [EP-tech] Custom Error Message for Screen Access / IRStats
- Next by Date: RE: [EP-tech] Custom Error Message for Screen Access / IRStats
- Previous by thread: [EP-tech] Custom Error Message for Screen Access / IRStats
- Next by thread: RE: [EP-tech] Custom Error Message for Screen Access / IRStats
- Index(es):
