diff --git a/config/vufind/EDS.ini b/config/vufind/EDS.ini index cc674a77c17..a71fc1e0730 100644 --- a/config/vufind/EDS.ini +++ b/config/vufind/EDS.ini @@ -26,6 +26,8 @@ common_limiters = FC,FT,RV ;advanced_limiters = RV,FC,FT common_expanders = fulltext default_view = brief +; If a warning should be shown on searches and records when the user only has a restricted view. +show_restricted_view_warning = false ; These are the default recommendations modules to use when no specific setting ; are found in the [TopRecommendations], [SideRecommendations] or @@ -281,10 +283,10 @@ profile = "PROFILE" organization_id = "VuFind from MyUniversity" ; If you have been provided with an EDS API Key, please provide these below. -; API keys are used to monitor access to EDS API, isolating traffic by customer and use-case. -; This isolation allows EBSCO to manage performance for specific keys (use cases). Should a request be throttled, -; the gateway will respond with an HTTP 429. Existing implementations may start using API keys at any time. -; EBSCO will require API keys for all customers at one point, but deadlines have not been established. +; API keys are used to monitor access to EDS API, isolating traffic by customer and use-case. +; This isolation allows EBSCO to manage performance for specific keys (use cases). Should a request be throttled, +; the gateway will respond with an HTTP 429. Existing implementations may start using API keys at any time. +; EBSCO will require API keys for all customers at one point, but deadlines have not been established. ; Customers may have more than one API key for separate client applications or use-cases accessing EDS API. ; Note: API keys do not replace EDS API’s authentication or session tokens. @@ -445,11 +447,11 @@ DetailPageFormat = 'Long' ;ShortAuthorLimit = 3 [AdditionalHeaders] -; Due to the nature of EDS API integrations EBSCO's web application firewall (WAF) does not have sufficient -; data to distinguish bots from users. By sending some end-user data to EDS API, EBSCO's WAF can make more -; informed decisions regarding bots. +; Due to the nature of EDS API integrations EBSCO's web application firewall (WAF) does not have sufficient +; data to distinguish bots from users. By sending some end-user data to EDS API, EBSCO's WAF can make more +; informed decisions regarding bots. ; This is important to guarantee accurate COUNTER 5 usage reports. The Counter Code of Practice 5.1 stipulates: -; "Activity generated by internet robots and crawlers MUST be excluded from all COUNTER usage reports." +; "Activity generated by internet robots and crawlers MUST be excluded from all COUNTER usage reports." ; See https://cop5.countermetrics.org/en/5.1/07-processing/08-internet-robots-and-crawlers.html ; If you are already protecting your site from bots, e.g. through your own WAF, you might not wish to enable this diff --git a/languages/de.ini b/languages/de.ini index 13091ce528a..8b892ed8f86 100644 --- a/languages/de.ini +++ b/languages/de.ini @@ -826,6 +826,7 @@ Located = "Standort" Location = "Standort" Log Out = "Log out" logged_in = "Sie haben sich eingeloggt." +logged_in_access_restricted = "Ihr Konto hat nicht vollen Zugriff." Login = "Login" Login for full access = "Für Vollzugriff bitte einloggen." login_disabled = "Login steht momentan nicht zur Verfügung." @@ -1487,6 +1488,7 @@ Theme = "Layout" Thesis = "Abschlussarbeit" This email was sent from = "Diese Mail wurde verschickt von" This field is required = "Pflichtfeld" +This is only a restricted view = "Dies ist nur eine eingeschränkte Ansicht." This item is already part of the following list/lists = "Dieser Datensatz ist bereits in der/den folgenden Liste/Listen enthalten" This result is not displayed to guests = "Dieser Treffer wird im Gastzugang nicht angezeigt." Title = "Titel" diff --git a/languages/en.ini b/languages/en.ini index 3229c2cd193..c12a6300db0 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -829,6 +829,7 @@ Located = "Located" Location = "Location" Log Out = "Log Out" logged_in = "You have logged in." +logged_in_access_restricted = "Your account has not been granted full access." Login = "Login" Login for full access = "Login for full access." login_disabled = "Login is not available at this time." @@ -1499,6 +1500,7 @@ Theme = "Theme" Thesis = "Thesis" This email was sent from = "This email was sent from" This field is required = "This field is required" +This is only a restricted view = "This is only a restricted view." This item is already part of the following list/lists = "This item is already part of the following list/lists" This result is not displayed to guests = "This result is not displayed to guests." Title = "Title" diff --git a/module/VuFind/src/VuFind/Search/Base/Options.php b/module/VuFind/src/VuFind/Search/Base/Options.php index f51b294511c..362dae6d640 100644 --- a/module/VuFind/src/VuFind/Search/Base/Options.php +++ b/module/VuFind/src/VuFind/Search/Base/Options.php @@ -393,6 +393,13 @@ abstract class Options implements TranslatorAwareInterface */ protected $displayCitationLinksInResults; + /** + * Should we display a warning in restricted views? + * + * @var bool + */ + protected bool $showRestrictedViewWarning; + /** * Constructor * @@ -430,6 +437,7 @@ public function __construct(\VuFind\Config\PluginManager $configLoader) $this->hiddenSortOptions = $searchSettings?->HiddenSorting?->pattern?->toArray() ?? []; $this->displayCitationLinksInResults = (bool)($searchSettings->Results_Settings->display_citation_links ?? true); + $this->showRestrictedViewWarning = (bool)($searchSettings->General->show_restricted_view_warning ?? false); } /** @@ -1387,4 +1395,14 @@ public function getHierarchicalFacetFilters(?string $field = null): array } return $this->hierarchicalFacetFilters; } + + /** + * Should we display a warning in restricted views? + * + * @return bool + */ + public function showRestrictedViewWarning(): bool + { + return $this->showRestrictedViewWarning ?? false; + } } diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php index 5b196c1dcba..0eae55e591a 100644 --- a/module/VuFind/src/VuFind/Search/Base/Results.php +++ b/module/VuFind/src/VuFind/Search/Base/Results.php @@ -189,6 +189,13 @@ abstract class Results */ protected $hierarchicalFacetHelper = null; + /** + * If the results provide only a restricted view. + * + * @var bool + */ + protected bool $restrictedView = false; + /** * Extra search details. * @@ -843,6 +850,16 @@ public function getFullFieldFacets( return $facets; } + /** + * Check if the results provide only a restricted view. + * + * @return bool + */ + public function isRestrictedView() + { + return $this->restrictedView; + } + /** * Get the extra search details * diff --git a/module/VuFind/src/VuFind/Search/EDS/Results.php b/module/VuFind/src/VuFind/Search/EDS/Results.php index d2dd73bad13..ab145b292f0 100644 --- a/module/VuFind/src/VuFind/Search/EDS/Results.php +++ b/module/VuFind/src/VuFind/Search/EDS/Results.php @@ -94,6 +94,7 @@ protected function performSearch() // Construct record drivers for all the items in the response: $this->results = $collection->getRecords(); + $this->restrictedView = $collection->isRestrictedView(); } } diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php index 7be769b05bf..3120e99abee 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php @@ -36,6 +36,7 @@ use VuFind\Config\Config; use VuFind\Config\Feature\SecretTrait; use VuFindSearch\Backend\AbstractBackend; +use VuFindSearch\Backend\EDS\Response\RecordCollection; use VuFindSearch\Backend\Exception\BackendException; use VuFindSearch\ParamBag; use VuFindSearch\Query\AbstractQuery; @@ -286,6 +287,9 @@ public function search( } $collection = $this->createRecordCollection($response); $this->injectSourceIdentifier($collection); + if ($this->isGuest && $collection instanceof RecordCollection) { + $collection->setRestrictedView(true); + } return $collection; } diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Response/RecordCollection.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Response/RecordCollection.php index a3ac9ce8f65..d9deed3e158 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Response/RecordCollection.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Response/RecordCollection.php @@ -56,6 +56,13 @@ class RecordCollection extends AbstractRecordCollection */ protected $facetFields = null; + /** + * If the results only provide a restricted view. + * + * @var bool + */ + protected bool $restrictedView = false; + /** * Constructor. * @@ -148,4 +155,26 @@ public function getOffset() } return 0; } + + /** + * Set if the results only provide a restricted view. + * + * @param bool $restrictedView If restricted view + * + * @return void + */ + public function setRestrictedView(bool $restrictedView): void + { + $this->restrictedView = $restrictedView; + } + + /** + * Check if the results only provide a restricted view. + * + * @return bool + */ + public function isRestrictedView() + { + return $this->restrictedView; + } } diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml index 3f5a0d48f3b..efaec059007 100644 --- a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml +++ b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml @@ -9,6 +9,7 @@ $cover = $coverDetails['html']; $edsConfig = $this->config()->get('EDS'); $authorDisplay = strtolower($edsConfig->AuthorDisplay->DetailPageFormat ?? 'Long'); + $searchOptions = $this->searchOptions($this->driver->getSourceIdentifier()); ?>
schemaOrg()->getAttributes(['vocab' => 'http://schema.org/', 'resource' => '#record', 'typeof' => $this->schemaOrg()->getRecordTypes($this->driver)])?>>
@@ -76,6 +77,10 @@ record($this->driver)->getLabelList() ?> + showRestrictedViewWarning() && $restrictedView): ?> + render('error/restrictedViewWarning.phtml')?> + + $item): ?> @@ -134,9 +139,7 @@ diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml index 7ce40b04427..034be0e42bd 100644 --- a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml @@ -74,9 +74,7 @@

transEsc('This result is not displayed to guests')?>
- + render('error/loginForAccess.phtml')?>

diff --git a/themes/bootstrap3/templates/combined/results-list.phtml b/themes/bootstrap3/templates/combined/results-list.phtml index 72d473d4493..5178966bf7a 100644 --- a/themes/bootstrap3/templates/combined/results-list.phtml +++ b/themes/bootstrap3/templates/combined/results-list.phtml @@ -128,6 +128,10 @@ +getOptions()->showRestrictedViewWarning() && $results->isRestrictedView()): ?> + render('error/restrictedViewWarning.phtml')?> + + extraErrors ?? [] as $error): ?>
transEsc($error)?>
diff --git a/themes/bootstrap3/templates/error/loginForAccess.phtml b/themes/bootstrap3/templates/error/loginForAccess.phtml index 3e90cee9614..6ce611364cc 100644 --- a/themes/bootstrap3/templates/error/loginForAccess.phtml +++ b/themes/bootstrap3/templates/error/loginForAccess.phtml @@ -1,4 +1,9 @@ - +auth()->getUserObject() !== null; ?> + + + + transEsc('logged_in_access_restricted');?> + diff --git a/themes/bootstrap3/templates/error/restrictedViewWarning.phtml b/themes/bootstrap3/templates/error/restrictedViewWarning.phtml new file mode 100644 index 00000000000..aa960b4da0e --- /dev/null +++ b/themes/bootstrap3/templates/error/restrictedViewWarning.phtml @@ -0,0 +1,4 @@ +
+ transEsc('This is only a restricted view')?> + render('error/loginForAccess.phtml')?> +
diff --git a/themes/bootstrap3/templates/search/results.phtml b/themes/bootstrap3/templates/search/results.phtml index 3d4ed65112b..0de19b881ed 100644 --- a/themes/bootstrap3/templates/search/results.phtml +++ b/themes/bootstrap3/templates/search/results.phtml @@ -85,6 +85,10 @@ + showRestrictedViewWarning() && $this->results->isRestrictedView()): ?> + render('error/restrictedViewWarning.phtml')?> + +

config()->get('EDS'); $authorDisplay = strtolower($edsConfig->AuthorDisplay->DetailPageFormat ?? 'Long'); + $searchOptions = $this->searchOptions($this->driver->getSourceIdentifier()); ?>

schemaOrg()->getAttributes(['vocab' => 'http://schema.org/', 'resource' => '#record', 'typeof' => $this->schemaOrg()->getRecordTypes($this->driver)])?>>
@@ -76,6 +77,10 @@ record($this->driver)->getLabelList() ?> + showRestrictedViewWarning() && $restrictedView): ?> + render('error/restrictedViewWarning.phtml')?> + +
transEsc('Bibliographic Details')?>
transEsc('Full text is not displayed to guests')?> - + render('error/loginForAccess.phtml')?>
$item): ?> @@ -134,9 +139,7 @@ diff --git a/themes/bootstrap5/templates/RecordDriver/EDS/result-list.phtml b/themes/bootstrap5/templates/RecordDriver/EDS/result-list.phtml index 7ce40b04427..034be0e42bd 100644 --- a/themes/bootstrap5/templates/RecordDriver/EDS/result-list.phtml +++ b/themes/bootstrap5/templates/RecordDriver/EDS/result-list.phtml @@ -74,9 +74,7 @@

transEsc('This result is not displayed to guests')?>
- + render('error/loginForAccess.phtml')?>

diff --git a/themes/bootstrap5/templates/combined/results-list.phtml b/themes/bootstrap5/templates/combined/results-list.phtml index 72d473d4493..5178966bf7a 100644 --- a/themes/bootstrap5/templates/combined/results-list.phtml +++ b/themes/bootstrap5/templates/combined/results-list.phtml @@ -128,6 +128,10 @@ +getOptions()->showRestrictedViewWarning() && $results->isRestrictedView()): ?> + render('error/restrictedViewWarning.phtml')?> + + extraErrors ?? [] as $error): ?>
transEsc($error)?>
diff --git a/themes/bootstrap5/templates/error/loginForAccess.phtml b/themes/bootstrap5/templates/error/loginForAccess.phtml index 3e90cee9614..6ce611364cc 100644 --- a/themes/bootstrap5/templates/error/loginForAccess.phtml +++ b/themes/bootstrap5/templates/error/loginForAccess.phtml @@ -1,4 +1,9 @@ - +auth()->getUserObject() !== null; ?> + + + + transEsc('logged_in_access_restricted');?> + diff --git a/themes/bootstrap5/templates/error/restrictedViewWarning.phtml b/themes/bootstrap5/templates/error/restrictedViewWarning.phtml new file mode 100644 index 00000000000..aa960b4da0e --- /dev/null +++ b/themes/bootstrap5/templates/error/restrictedViewWarning.phtml @@ -0,0 +1,4 @@ +
+ transEsc('This is only a restricted view')?> + render('error/loginForAccess.phtml')?> +
diff --git a/themes/bootstrap5/templates/search/results.phtml b/themes/bootstrap5/templates/search/results.phtml index 3d4ed65112b..0de19b881ed 100644 --- a/themes/bootstrap5/templates/search/results.phtml +++ b/themes/bootstrap5/templates/search/results.phtml @@ -85,6 +85,10 @@ + showRestrictedViewWarning() && $this->results->isRestrictedView()): ?> + render('error/restrictedViewWarning.phtml')?> + +

transEsc('Bibliographic Details')?>
transEsc('Full text is not displayed to guests')?> - + render('error/loginForAccess.phtml')?>