From 9aa9269eddd6e43b10b8ad8245eda0e887422f52 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 4 Aug 2014 13:16:02 -0400 Subject: [PATCH] LP#1350042 detect is-staff mode for browser client The browser client does not pass an OILS-Wrapper header to the embedded catalog (etc.) so consider the presence of a workstation an indication that the TPAC should operate in staff mode. NOTE: this may require some additional thought, since this means all TPACs within an authenticated browser will run in staff mode, which may not be desired. Signed-off-by: Bill Erickson Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 5e8743ef28..eda0c657bd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -260,10 +260,17 @@ sub load_common { $ctx->{full_path} = $ctx->{base_path} . $self->cgi->path_info; $ctx->{unparsed_uri} = $self->apache->unparsed_uri; $ctx->{opac_root} = $ctx->{base_path} . "/opac"; # absolute base url - my $oils_wrapper = $self->apache->headers_in->get('OILS-Wrapper') || ''; - $ctx->{is_staff} = ($oils_wrapper =~ /true/); - $ctx->{proto} = 'oils' if $ctx->{is_staff}; - $ctx->{hostname} = 'remote' if $ctx->{is_staff}; + + my $xul_wrapper = + ($self->apache->headers_in->get('OILS-Wrapper') || '') =~ /true/; + + if ($xul_wrapper) { + # XUL client + $ctx->{is_staff} = 1; + $ctx->{proto} = 'oils'; + $ctx->{hostname} = 'remote'; + } + $ctx->{physical_loc} = $self->get_physical_loc; # capture some commonly accessed pages @@ -279,6 +286,17 @@ sub load_common { $ctx->{user} = $e->requestor; $ctx->{place_unfillable} = 1 if $e->requestor->wsid && $e->allowed('PLACE_UNFILLABLE_HOLD', $e->requestor->ws_ou); + # The browser client does not set an OILS-Wrapper header (above). + # The presence of a workstation and no header indicates staff mode. + # FIXME: this approach leaves un-wrapped TPAC's within the same + # browser (and hence same ses cookie) in an unnatural is_staff + # state. Consider alternatives for determining is_staff / + # is_browser_staff when $xul_wrapper is false. + if (!$xul_wrapper and $e->requestor->wsid) { + $ctx->{is_staff} = 1; + $ctx->{is_browser_staff} = 1; + } + $ctx->{user_stats} = $U->simplereq( 'open-ils.actor', 'open-ils.actor.user.opac.vital_stats', -- 2.43.2