94 lines
2.7 KiB
PHP
94 lines
2.7 KiB
PHP
<?php
|
|
class IndexController extends Zend_Controller_Action
|
|
{
|
|
protected $serviceList = array(
|
|
'Entreprise' => array(
|
|
'titre' => 'WebService Entreprise',
|
|
'protect' => array(),
|
|
),
|
|
'Interne' => array(
|
|
'titre' => 'WebService Interne',
|
|
'protect' => array('mricois', 'ylenaour', 'dlasserre')
|
|
),
|
|
);
|
|
|
|
protected $serviceClientList = array(
|
|
'Afnic' => array(
|
|
'titre' => 'WebService Client Afnic',
|
|
'protect' => array('mricois', 'ylenaour'),
|
|
),
|
|
);
|
|
|
|
public function init()
|
|
{
|
|
//Gestion des versions pour les webservices standard
|
|
foreach($this->serviceList as $serviceName => $serviceInfo)
|
|
{
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/'.$serviceName.'/Versions.ini', null);
|
|
$serviceVersions = array();
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
|
{
|
|
$serviceVersions[$section] = $params;
|
|
$this->serviceList[$serviceName]['version'] = $serviceVersions;
|
|
}
|
|
}
|
|
|
|
//Gestion des versions pour les webservices clients
|
|
foreach($this->serviceClientList as $serviceName => $serviceInfo)
|
|
{
|
|
$configServiceVersions = new Zend_Config_Ini('WsScore/Clients/'.strtolower($serviceName).'/Versions.ini', null);
|
|
$serviceVersions = array();
|
|
foreach( $configServiceVersions->toArray() as $section => $params )
|
|
{
|
|
$serviceVersions[$section] = $params;
|
|
$this->serviceClientList[$serviceName]['version'] = $serviceVersions;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function preDispatch()
|
|
{
|
|
$auth = Zend_Auth::getInstance();
|
|
if (!$auth->hasIdentity()){
|
|
$this->_redirect('/user/login');
|
|
} else {
|
|
$bootstrap = $this->getInvokeArg('bootstrap');
|
|
$this->appConfig = $bootstrap->getOptions();
|
|
}
|
|
}
|
|
|
|
public function indexAction()
|
|
{
|
|
$username = Zend_Auth::getInstance()->getIdentity()->username;
|
|
$displayWs = array();
|
|
//Traitement des webservices standard
|
|
foreach($this->serviceList as $key => $ws)
|
|
{
|
|
if ( count($ws['protect'])==0 || in_array($username, $ws['protect']) )
|
|
{
|
|
$displayWs[$key] = $ws;
|
|
}
|
|
}
|
|
//Traitement des webservice clients
|
|
foreach($this->serviceClientList as $key => $ws)
|
|
{
|
|
if ( count($ws['protect'])==0 || in_array($username, $ws['protect']) )
|
|
{
|
|
$displayWs[$key] = $ws;
|
|
$displayWs[$key]['type'] = 'client';
|
|
}
|
|
}
|
|
$this->view->assign('ws', $displayWs);
|
|
}
|
|
|
|
public function testAction()
|
|
{
|
|
//Connexion au service - Faire comme ci on charger le WSDL de l'extérieur
|
|
//getFunctions / getTypes
|
|
//Pour chaque Function, identifier les Types puis proposer les champs associés
|
|
//Valider les formulaires pour executer la requête du service
|
|
//Utiliser le jeux de tests disponible
|
|
}
|
|
}
|
|
|