webservice/application/controllers/IndexController.php

61 lines
1.6 KiB
PHP
Raw Normal View History

2010-08-30 07:49:44 +00:00
<?php
class IndexController extends Zend_Controller_Action
{
protected $serviceVersions = array();
public function init()
{
$configServiceVersions = new Zend_Config_Ini('WsScore/Versions.ini', null);
foreach( $configServiceVersions->toArray() as $section => $params ){
$this->serviceVersions[$section] = $params;
}
}
2010-08-30 07:49:44 +00:00
2010-09-13 09:53:55 +00:00
public function preDispatch()
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()){
$this->_redirect('/user/login');
} else {
$bootstrap = $this->getInvokeArg('bootstrap');
$this->appConfig = $bootstrap->getOptions();
2010-09-13 09:53:55 +00:00
}
}
2010-08-30 07:49:44 +00:00
public function indexAction()
{
$listeWs = array(
'WsEntreprise' => array(
'titre' => 'WebService Entreprise',
'protect'=> array(),
'version' => $this->serviceVersions,
),
'WsInterne' => array(
'titre' => 'WebService Interne',
'protect'=> array('mricois', 'ylenaour', 'sbeaugrand')
),
);
2010-08-30 07:49:44 +00:00
2011-01-24 15:47:24 +00:00
$username = Zend_Auth::getInstance()->getIdentity()->username;
$displayWs = array();
foreach($listeWs as $key => $ws)
{
2011-01-24 15:47:24 +00:00
if ( count($ws['protect'])==0 || in_array($username, $ws['protect']) )
{
$displayWs[$key] = $ws;
}
}
$this->view->assign('ws', $displayWs);
}
2010-09-13 09:53:55 +00:00
public function testAction()
{
2010-10-08 07:37:43 +00:00
//Connexion au service - Faire comme ci on charger le WSDL de l'extérieur
2010-09-23 16:20:08 +00:00
//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
}
2010-08-30 07:49:44 +00:00
}