mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
fix api/v3 api_version
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Controller\Api;
|
||||
|
||||
use Alchemy\Phrasea\ControllerProvider\Api\V1;
|
||||
use Alchemy\Phrasea\ControllerProvider\Api\V3;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -272,6 +273,8 @@ class Result
|
||||
$this->version = $this->request->attributes->get('api_version');
|
||||
} elseif (mb_strpos($this->request->getPathInfo(), '/api/v1') !== FALSE) {
|
||||
$this->version = V1::VERSION;
|
||||
} elseif (mb_strpos($this->request->getPathInfo(), '/api/v3') !== FALSE) {
|
||||
$this->version = V3::VERSION;
|
||||
} else {
|
||||
$this->version = self::$defaultVersion;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use Silex\ServiceProviderInterface;
|
||||
|
||||
class V3 extends Api implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
const VERSION = '2.0.0';
|
||||
const VERSION = '3.0.0';
|
||||
|
||||
public function register(Application $app)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Authentication\Context;
|
||||
use Alchemy\Phrasea\Controller\Api\Result;
|
||||
use Alchemy\Phrasea\ControllerProvider\Api\V1;
|
||||
use Alchemy\Phrasea\ControllerProvider\Api\V2;
|
||||
use Alchemy\Phrasea\ControllerProvider\Api\V3;
|
||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||
use Alchemy\Phrasea\Core\Event\ApiOAuth2EndEvent;
|
||||
use Alchemy\Phrasea\Core\Event\ApiOAuth2StartEvent;
|
||||
@@ -80,6 +81,8 @@ class OAuthListener
|
||||
$request->attributes->set('api_version', V1::VERSION);
|
||||
} elseif(mb_strpos($CalledController, 'controller.api.v2') !== FALSE) {
|
||||
$request->attributes->set('api_version', V2::VERSION);
|
||||
} elseif(mb_strpos($CalledController, 'controller.api.v3') !== FALSE) {
|
||||
$request->attributes->set('api_version', V3::VERSION);
|
||||
} else {
|
||||
$request->attributes->set('api_version', $oAuth2Account->getApiVersion());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user