Skip to content
Snippets Groups Projects
Commit a95b1422 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #30641 add cas orthodidacte

parent 27283c7e
Branches
Tags
8 merge requests!1553Master,!1502Master,!1501Stable,!1363Master,!1362Master,!1360Master,!1357Dev#30641 cas orthodidacte,!1349Dev#30641 cas orthodidacte
- ticket #30641 : Ajout du connecteur CAS vers la plateform ORTHODIDACTE.
\ No newline at end of file
......@@ -70,7 +70,6 @@ class Admin_IndexController extends ZendAfi_Controller_Action {
$this->view->url(['action' => 'adminvar']));
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
xdebug_break();
$new_valeur = $form->getAdminVarValue();
$var->setValeur($new_valeur);
......
......@@ -118,4 +118,11 @@ class ModulesController extends Zend_Controller_Action {
$this->getResponse()->setHeader('Content-Type', 'text/html;charset=utf-8');
$this->getResponse()->setBody('<script>window.location="'.$url.'";</script>');
}
public function orthodidacteAction() {
$orthodidacte = new Class_Systeme_ModulesMenu_Orthodidacte();
$orthodidacte->afterLoginRedirectTo(Class_Url::absolute($this->view->url()));
$this->checkNotifyMessage($orthodidacte, $orthodidacte->getDynamiqueUrl());
}
}
......@@ -266,6 +266,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'PLANETNEMO' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la ressource numérique PlanetNemo'))->bePrivate(),
'ORTHODIDACTE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la ressource numérique Orthodidacte'))->bePrivate(),
'LECTURA_DOMAIN' => Class_AdminVar_Meta::newDefault($this->_('Domaine utilisée par le serveur lectura pour authentification')),
'LEKIOSK_ID' => Class_AdminVar_Meta::newDefault($this->_('Identifiant fournit par lekiosk.com'))->bePrivate(),
......@@ -482,6 +484,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
}
public function isOrthodidacteEnabled() {
return ('' != Class_AdminVar::get('ORTHODIDACTE'));
}
public function isNumeriquePremiumEnabled() {
return '' != Class_AdminVar::get('NUMERIQUE_PREMIUM_URL');
}
......
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Orthodidacte_Link {
const ROOT_URL = 'https://plateforme.orthodidacte.com/authenticate?';
protected $_id, $_last_name, $_first_name, $_mail;
public static function newFor($user) {
return self::ROOT_URL
. http_build_query(
[
'cas_fournisseur' => Class_Url::absolute(['controller' => 'cas-server-v10'], null, true),
'id' => $user->getIdabon(),
'nom' => $user->getNom(),
'prenom' => $user->getPrenom(),
'mail' => ''
] );
}
}
?>
\ No newline at end of file
......@@ -120,6 +120,7 @@ class Class_Systeme_ModulesMenu extends Class_Systeme_ModulesAbstract {
"NUMILOG" => new Class_Systeme_ModulesMenu_Numilog(),
"ARTEVOD" => new Class_Systeme_ModulesMenu_ArteVod(),
"LEKIOSK" => new Class_Systeme_ModulesMenu_LeKiosk(),
"ORTHODIDACTE" => new Class_Systeme_ModulesMenu_Orthodidacte(),
"MUSICME" => new Class_Systeme_ModulesMenu_MusicMe(),
"MYCOW" => new Class_Systeme_ModulesMenu_MyCow(),
"PLANETNEMO" => new Class_Systeme_ModulesMenu_PlanetNemo(),
......
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Systeme_ModulesMenu_Orthodidacte extends Class_Systeme_ModulesMenu_SSOAbstract {
/** @var string */
protected $_group = Class_Systeme_ModulesMenu::GROUP_MENU_ABONNES;
/** @var string */
protected $_type_module = 'ORTHODIDACTE';
/** @var string */
protected $_libelle = 'Lien vers Orthodidacte';
protected $_url = [
'controller' => 'modules',
'action' => 'orthodidacte'
];
public function urlForUser($user) {
if (!$user->hasRightAccesOrthodidacte()) {
$this->setMessage($this->_('Votre abonnement ne permet pas d\'accéder aux ressources Orthodidacte. Merci de contacter la médiathèque'));
return '';
}
return Class_Orthodidacte_Link::newFor($user);
}
public function isVisibleForProfil($profil) {
return Class_AdminVar::isOrthodidacteEnabled();
}
}
?>
\ No newline at end of file
......@@ -57,6 +57,7 @@ class Class_UserGroup extends Storm_Model_Abstract {
const RIGHT_ACCES_KIDILANGUES = 25;
const RIGHT_ACCES_PNB_DILICOM = 26;
const RIGHT_ACCES_PLANETNEMO = 27;
const RIGHT_ACCESS_ORTHODIDACTE = 28;
// droits moderateurs
const RIGHT_USER_DOMAINES_SUPPRESSION_LIMIT = 8;
......@@ -96,6 +97,7 @@ class Class_UserGroup extends Storm_Model_Abstract {
self::RIGHT_ACCES_MYCOW => 'Bibliothèque numérique: accéder à MyCOW.EU',
self::RIGHT_ACCES_PLANETNEMO => 'Bibliothèque numérique: accéder à planetnemo.fr',
self::RIGHT_ACCES_KIDILANGUES => 'Bibliothèque numérique: accéder à Kidilangues',
self::RIGHT_ACCESS_ORTHODIDACTE => 'Bibliothèque numérique: accéder à Orthodidacte.com',
self::RIGHT_ACCES_PNB_DILICOM => 'Bibliothèque numérique: autoriser le prêt numérique Dilicom',
self::RIGHT_USER_DOMAINES_SUPPRESSION_LIMIT => 'Domaines: accès, modification et suppression limitée au créateur',
self::RIGHT_USER_DOMAINES_TOTAL_ACCESS => 'Domaines: accès total en modification et suppression',
......
......@@ -813,6 +813,11 @@ class Class_Users extends Storm_Model_Abstract {
}
public function hasRightAccesOrthodidacte() {
return $this->isAbonneAndHasRightToAccess(Class_UserGroup::RIGHT_ACCESS_ORTHODIDACTE);
}
public function getFirstAvisByIdNotice($id_notice) {
$notice = Class_Notice::getLoader()->find($id_notice);
$avis = $notice->getAvisByUser($this);
......
......@@ -196,5 +196,15 @@
"sales_contact": {"mail" : "",
"name" : "",
"url" : "http://www.vodeclic.com/fr/solutions/bibliotheques"}
},
"ORTHODIDACTE": {
"label" : "Orthodidacte",
"url" : "http://www.orthodidacte.com/",
"image_url" : "http://bokeh-library-portal.org/userfiles/media/ressources_numeriques/logo_orthodidacte_pastille.png",
"desc": "Orthodidacte constitue une nouvelle approche pour apprendre l’orthographe et la grammaire de la langue française en ligne.",
"features": ["CAS"],
"sales_contact": {"mail" : "",
"name" : "",
"url" : "http://www.orthodidacte.com"}
}
}
......@@ -202,3 +202,104 @@ class ModulesControllerNumeriquepremiumTest extends AbstractControllerTestCase {
$this->assertXPathContentContains('//script', 'http://foo/', $this->_response->getBody());
}
}
class ModulesControllerLoginRequiredOrthodidacteTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
/** @test */
public function shouldRedirectToLogin() {
RessourcesNumeriquesFixtures::activateOrthodidacte();
$_SERVER['HTTP_REFERER'] = '/opac/cms/articleview/id/23';
ZendAfi_Auth::getInstance()->clearIdentity();
$this->dispatch('/opac/modules/orthodidacte');
$this->assertContains('/auth/login?redirect='.urlencode(ROOT_URL . BASE_URL . '/modules/orthodidacte'),
$this->_response->getBody());
}
}
class ModulesControllerOrthodidacteUserWithoutGroupTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
RessourcesNumeriquesFixtures::activateOrthodidacte();
$this->dispatch('/opac/modules/orthodidacte', true);
}
/** @test */
public function shouldHaveAccessForbiddenMessage() {
$this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
}
}
class ModulesControllerOrthodidacteUserWithGroupWithoutRightTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
RessourcesNumeriquesFixtures::activateOrthodidacte();
$group = $this->fixture('Class_UserGroup', ['id' => 1]);
Class_Users::getIdentity()->setUserGroups([$group]);
$this->dispatch('/opac/modules/orthodidacte', true);
}
/** @test */
public function shouldHaveAccessForbiddenMessage() {
$this->assertFlashMessengerContentContains('Votre abonnement ne permet pas');
}
}
class ModulesControllerOrthodidacteUserWithGroupWithRightTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
RessourcesNumeriquesFixtures::activateOrthodidacte();
$group = $this->fixture('Class_UserGroup', ['id' => 1])
->addRight(Class_UserGroup::RIGHT_ACCESS_ORTHODIDACTE);
Class_Users::getIdentity()->setUserGroups([$group]);
$this->dispatch('/opac/modules/orthodidacte', true);
}
/** @test */
public function shouldHaveAccessToOrthodidacte() {
$this->assertContains('https://plateforme.orthodidacte.com', $this->_response->getBody());
}
}
class ModulesControllerOrthodidacteUserWithGroupWithRightCasTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
RessourcesNumeriquesFixtures::activateOrthodidacte();
$group = $this->fixture('Class_UserGroup', ['id' => 1])
->addRight(Class_UserGroup::RIGHT_ACCESS_ORTHODIDACTE);
Class_Users::getIdentity()->setUserGroups([$group]);
$_SERVER['HTTP_REFERER'] = 'http://localhost/view/notice';
$this->dispatch('/opac/modules/orthodidacte', true);
}
/** @test */
public function shouldHaveAccessToOrthodidacte() {
$this->assertContains('https://plateforme.orthodidacte.com/authenticate',
$this->_response->getBody());
}
}
......@@ -37,6 +37,7 @@ class RessourcesNumeriquesFixtures {
self::deactivateKidilangues();
self::deactivateJamendo();
self::deactivateDilicom();
self::deactiveteOthodidacte();
}
......@@ -58,6 +59,7 @@ class RessourcesNumeriquesFixtures {
self::activateKidilangues();
self::activateJamendo();
self::activateDilicom();
self::activateOrthodidacte();
}
......@@ -276,6 +278,14 @@ class RessourcesNumeriquesFixtures {
Class_AdminVar::newInstanceWithId('DILICOM_PNB_GLN_CONTRACTOR', ['valeur' => '']);
Class_AdminVar::newInstanceWithId('DILICOM_PNB_IP_ADRESSES', ['valeur' => '']);
}
}
public static function activateOrthodidacte() {
Class_AdminVar::newInstanceWithId('OTHODIDACTE', ['valeur' => '1']);
}
public static function deactivateOrthodidacte() {
Class_AdminVar::newInstanceWithId('OTHODIDACTE', ['valeur' => '0']);
}
}
?>
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