Jonathan Druart
df23f6c345
The userenv (logged in user's info) are stored in $C4::Context->context->{activeuser}, which persists in plack worker's memory. It's really bad in theory as we are not cleaning it before or after the HTTP request, but only when set_userenv is called (what we are doing commonly in C4::Auth::get_template_and_user). If C4::Context->userenv is called before set_userenv we should get undef, not the userenv from the previous request! In practice this should not be a problem, but well... who really knows? This patch suggests to have a middleware to deal with removing the userenv at the beginning of each request (maybe it should be after, right? - FIXME). To test: 1 - Edit /etc/koha/sites/kohadev/koha-conf.xml to set <plack_workers>1</plack_workers> 2 - Edit about.pl and add a line after: CGI->new: warn Data::Dumper::Dumper( C4::Cointext->userenv() ); 3 - tail -f /var/log/koha/kohadev/*.log 4 - View about.pl in staff interface, should get a "somethign's wrong" warning 5 - Reload, you get current user info 6 - Open an incognito tab, sign in as a different user and click some stuff 7 - Reload about.pl in other window 8 - You get the opac user info 9 - Apply patch 10 - Edit /etc/koha/sites/kohadev/plack.psgi and add the middleware after "RealIP": enable "+Koha::Middleware::UserEnv"; 11 - Restart all 12 - Reload about.pl - you get a "Something's wrong" warning 13 - Click things in opac on incognito window 14 - Reload about.pl - only "Something's wrong" - you no longer see any user info Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> |
||
---|---|---|
.. | ||
AuthoritiesMarc | ||
Barcodes | ||
ClassSortRoutine | ||
ClassSplitRoutine | ||
Creators | ||
External | ||
Form | ||
Heading | ||
ILSDI | ||
Installer | ||
Labels | ||
Linker | ||
Members | ||
OAI | ||
Output | ||
Patroncards | ||
Reports | ||
Search | ||
Serials | ||
SIP | ||
Utils/DataTables | ||
Accounts.pm | ||
Acquisition.pm | ||
Auth.pm | ||
Auth_cas_servers.yaml.sample | ||
Auth_with_cas.pm | ||
Auth_with_ldap.pm | ||
Auth_with_shibboleth.pm | ||
AuthoritiesMarc.pm | ||
Barcodes.pm | ||
Biblio.pm | ||
Breeding.pm | ||
Budgets.pm | ||
Calendar.pm | ||
Charset.pm | ||
Circulation.pm | ||
ClassSortRoutine.pm | ||
ClassSource.pm | ||
ClassSplitRoutine.pm | ||
Context.pm | ||
Contract.pm | ||
CourseReserves.pm | ||
Creators.pm | ||
Heading.pm | ||
HoldsQueue.pm | ||
HTML5Media.pm | ||
ImportBatch.pm | ||
ImportExportFramework.pm | ||
InstallAuth.pm | ||
Installer.pm | ||
ItemCirculationAlertPreference.pm | ||
Items.pm | ||
Koha.pm | ||
Labels.pm | ||
Languages.pm | ||
Letters.pm | ||
Linker.pm | ||
Log.pm | ||
MarcModificationTemplates.pm | ||
Matcher.pm | ||
Members.pm | ||
Message.pm | ||
Output.pm | ||
Overdues.pm | ||
Patroncards.pm | ||
Record.pm | ||
Reports.pm | ||
Reserves.pm | ||
Ris.pm | ||
RotatingCollections.pm | ||
Scheduler.pm | ||
Scrubber.pm | ||
Search.pm | ||
Serials.pm | ||
Service.pm | ||
ShelfBrowser.pm | ||
SMS.pm | ||
SocialData.pm | ||
Stats.pm | ||
Suggestions.pm | ||
Tags.pm | ||
Templates.pm | ||
TmplToken.pm | ||
TmplTokenType.pm | ||
TTParser.pm | ||
UsageStats.pm | ||
XISBN.pm | ||
XSLT.pm |