Skip to content
Snippets Groups Projects
Commit a7c64db4 authored by Dorian Merz's avatar Dorian Merz Committed by Robert Lange
Browse files

refs #19381 [fid_bbi] show licensed databases for all users

* link only for authorized users
* show unproxied links for unauthorized users
parent ceb7425c
No related merge requests found
...@@ -206,7 +206,11 @@ alphabet_letters = "AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZ" ...@@ -206,7 +206,11 @@ alphabet_letters = "AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZ"
alphabetical_order = true alphabetical_order = true
[MediaLicenses] [MediaLicenses]
BookHistoryOnline = "https://fid-bbi.idm.oclc.org/login?url=https://bibliographies.brillonline.com/browse/book-history-online" ; BEWARE: currently the user authorization used in databases.phtml relies on
; ALL licenses being provided via EZproxy. This way we can show unproxied links
; for unauthorized users
; the following links will be presented to ALL users
BookHistoryOnline = "https://bibliographies.brillonline.com/browse/book-history-online"
[ExternalDatabases] [ExternalDatabases]
DBIS = true DBIS = true
...@@ -70,4 +70,21 @@ class MyResearchController extends \fid\Controller\MyResearchController ...@@ -70,4 +70,21 @@ class MyResearchController extends \fid\Controller\MyResearchController
} }
return $this->createViewModel(compact('lists','tags')); return $this->createViewModel(compact('lists','tags'));
} }
/**
* Check if licenses are specified
* overrides parent function avoiding authentication
*
* @return bool
*/
public function hasLicenses(): bool
{
// Are licenses configured
if (!isset($this->mainConfig['MediaLicenses']) || count($this->mainConfig['MediaLicenses']) == 0) {
return false;
}
return true;
}
} }
...@@ -20,14 +20,25 @@ $account = $this->auth()->getManager(); ...@@ -20,14 +20,25 @@ $account = $this->auth()->getManager();
<div class="narrow"> <div class="narrow">
<h2><?=$this->translate('licenses')?></h2> <h2><?=$this->translate('licenses')?></h2>
<?php if (!$account->isLoggedIn()): ?> <?php if (!empty($licenses) && $this->permission()->allowDisplay('access.Licenses')): ?>
<p><?=$this->translate('licenses_forbidden_login_required')?></p> <p><?=$this->translate('licenses_text')?></p>
<?php elseif (!$this->permission()->allowDisplay('access.Licenses')) : ?>
<p><?=$this->translate('licenses_forbidden_permission_denied')?></p> <ul class="licenses">
<?php foreach ($licenses as $license): ?>
<li>
<?=$this->externalLink($this->proxyUrl($license['url']), $this->translate('licenses_' . $license['name']))?>
<?php if (!empty($license['desc'])): ?>(<?=$license['desc']?>)<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php elseif (empty($licenses)) : ?> <?php elseif (empty($licenses)) : ?>
<p><?=$this->translate('licenses_not_available')?></p> <p><?=$this->translate('licenses_not_available')?></p>
<?php else: ?> <?php else: ?>
<p><?=$this->translate('licenses_text')?></p> <?php if (!$account->isLoggedIn()): ?>
<p><?=$this->translate('licenses_forbidden_login_required')?></p>
<?php else: ?>
<p><?=$this->translate('licenses_forbidden_permission_denied')?></p>
<?php endif; ?>
<ul class="licenses"> <ul class="licenses">
<?php foreach ($licenses as $license): ?> <?php foreach ($licenses as $license): ?>
...@@ -39,6 +50,7 @@ $account = $this->auth()->getManager(); ...@@ -39,6 +50,7 @@ $account = $this->auth()->getManager();
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<?php if ($this->isDbisAvailable) : ?> <?php if ($this->isDbisAvailable) : ?>
<?=$this->render('myresearch/dbis-content')?> <?=$this->render('myresearch/dbis-content')?>
<?php endif; ?> <?php endif; ?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment