Commit e5f74908 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge remote-tracking branch 'refs/remotes/origin/stable'

Conflicts:
	VERSIONS
	VERSIONS_HOTLINE/65680
	library/startup.php
parents 336a2327 9bc3571c
- ticket #65680 : Ressources numériques : correction de l'accès à la ressource Arte VOD.
\ No newline at end of file
......@@ -25,8 +25,8 @@ class Class_ArteVodLink {
protected $_album;
protected $_user;
const
BASE_URL = 'https://vod.mediatheque-numerique.com',
LOGIN_SUFFIX = '/sso_login',
AUTH_URL = 'https://portal.mediatheque-numerique.com/sso_login',
API_URL = 'https://vod.mediatheque-numerique.com',
API_SUFFIX = '/api/v1/',
MEDIATHEQUES_SUFFIX = '/mediatheques/';
......@@ -57,7 +57,7 @@ class Class_ArteVodLink {
if ($this->_album)
return $this->_album->getExternalUri();
return static::BASE_URL . static::MEDIATHEQUES_SUFFIX . Class_AdminVar::get('ARTE_VOD_LOGIN');
return static::API_URL . static::MEDIATHEQUES_SUFFIX . Class_AdminVar::get('ARTE_VOD_LOGIN');
}
......@@ -78,8 +78,7 @@ class Class_ArteVodLink {
'datout' => $this->_user->getDateFin(),
'return_url' => $this->baseUrl()];
return static::BASE_URL
. static::LOGIN_SUFFIX
return static::AUTH_URL
. '?'
. http_build_query(array_filter($params));
}
......
......@@ -24,13 +24,8 @@ class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumeriqu
const CATEGORY_LABEL = 'ArteVOD';
public function apiLink() {
return Class_ArteVodLink::BASE_URL . Class_ArteVodLink::API_SUFFIX;
}
protected function loadPage($page_number = 1) {
$url = $this->apiLink() . self::FILMS . '?page_nb=' . $page_number;
$url = $this->getBaseUrl() . self::FILMS . '?page_nb=' . $page_number;
$content = $this->open_authenticated_url($url);
if ('' == $content) {
$this->getLogger()->error('Erreur de communication');
......@@ -78,12 +73,12 @@ class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumeriqu
protected function _deleteNonHarvested() {
if (0 < count($this->getHarvestedIds()))
Class_Album::getLoader()
->deleteBy(['where' => 'url_origine="' . $this->apiLink() . '" and id_origine not in (\'' . implode("', '", $this->getHarvestedIds()) . '\')']);
->deleteBy(['where' => 'url_origine="' . $this->getBaseUrl() . '" and id_origine not in (\'' . implode("', '", $this->getHarvestedIds()) . '\')']);
}
public function getBaseUrl() {
return $this->apiLink();
return Class_ArteVodLink::API_URL . Class_ArteVodLink::API_SUFFIX;
}
public function isEnabled() {
......@@ -94,6 +89,4 @@ class Class_WebService_BibNumerique_ArteVOD extends Class_WebService_BibNumeriqu
public function getName() {
return 'ArteVOD';
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -140,7 +140,7 @@ class Class_WebService_BibNumerique_ArteVOD_Film extends Class_WebService_BibNu
public function getBaseUrl(){
return (new Class_WebService_BibNumerique_ArteVOD)->apiLink();
return (new Class_WebService_BibNumerique_ArteVOD)->getBaseUrl();
}
}
......
......@@ -144,7 +144,7 @@ class ModulesControllerArteVodTest extends AbstractControllerTestCase {
$this->dispatch('/opac/modules/artevod');
$this->assertXpathContentContains('//script',
'document.location.href="https://vod.mediatheque-numerique.com/sso_login?sso_id=afi&id=666&id_encrypted=ce04173447e59a7a3608f625b0348ccec5f4070c7c3f286b032cbe6374ec9f32&d=d8fb24f80a99bded9ed417591c5ac5cc1e123bcce10d65e1f6a83211ca18d3e8&return_url=https%3A%2F%2Fvod.mediatheque-numerique.com%2Fmediatheques%2Fuser";');
'document.location.href="https://portal.mediatheque-numerique.com/sso_login?sso_id=afi&id=666&id_encrypted=ce04173447e59a7a3608f625b0348ccec5f4070c7c3f286b032cbe6374ec9f32&d=d8fb24f80a99bded9ed417591c5ac5cc1e123bcce10d65e1f6a83211ca18d3e8&return_url=https%3A%2F%2Fvod.mediatheque-numerique.com%2Fmediatheques%2Fuser";');
}
}
......
......@@ -73,7 +73,7 @@ class ArteVodLinkWithUserAndAlbumTest extends Storm_Test_ModelTestCase {
public function withKeySECRETUrlShouldContainsEncryptedDate() {
Class_AdminVar::newInstanceWithId('ARTE_VOD_SSO_KEY')->setValeur('GOGO');
$this->assertEquals('https://vod.mediatheque-numerique.com/sso_login'
$this->assertEquals('https://portal.mediatheque-numerique.com/sso_login'
.'?sso_id=afi'
.'&id=45'
.'&id_encrypted='. hash('sha256', '45GOGO')
......@@ -97,7 +97,7 @@ class ArteVodLinkWithUserAndAlbumTest extends Storm_Test_ModelTestCase {
->setNom('')
->setMail('');
$this->assertEquals('https://vod.mediatheque-numerique.com/sso_login'
$this->assertEquals('https://portal.mediatheque-numerique.com/sso_login'
.'?sso_id=afi'
.'&id=45'
.'&id_encrypted='. hash('sha256', '45secret')
......@@ -120,7 +120,7 @@ class ArteVodLinkWithUserAndAlbumTest extends Storm_Test_ModelTestCase {
->setDateFin('')
->beInvite();
$this->assertEquals('https://vod.mediatheque-numerique.com/sso_login'
$this->assertEquals('https://portal.mediatheque-numerique.com/sso_login'
.'?sso_id=afi'
.'&id=19'
.'&id_encrypted='. hash('sha256', '19secret')
......@@ -143,7 +143,7 @@ class ArteVodLinkWithUserAndAlbumTest extends Storm_Test_ModelTestCase {
->setDateFin('')
->setNaissance('1975-01-01');
$this->assertEquals('https://vod.mediatheque-numerique.com/sso_login'
$this->assertEquals('https://portal.mediatheque-numerique.com/sso_login'
.'?sso_id=afi'
.'&id=45'
.'&id_encrypted='. hash('sha256', '45secret')
......
Markdown is supported
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