mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Set OAuth2_Adapter default API version
This commit is contained in:
@@ -21,7 +21,7 @@ class APIServiceProvider implements ServiceProviderInterface
|
||||
public function register(Application $app)
|
||||
{
|
||||
$app['oauth2-server'] = $app->share(function ($app) {
|
||||
return new \API_OAuth2_Adapter($app);
|
||||
return new \API_OAuth2_Adapter($app, ['api_version' => $app['api.default_version']]);
|
||||
});
|
||||
$app['token'] = $app->share(function (Application $app) {
|
||||
/** @var \API_OAuth2_Adapter $oauth2 */
|
||||
|
@@ -473,16 +473,16 @@ class API_OAuth2_Adapter extends OAuth2
|
||||
* @param User $user
|
||||
*
|
||||
* @return mixed
|
||||
* @throws logicalException
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function updateAccount(User $user)
|
||||
{
|
||||
if ($this->client === null) {
|
||||
throw new logicalException("Client property must be set before update an account");
|
||||
throw new LogicException("Client property must be set before update an account");
|
||||
}
|
||||
|
||||
if (null === $account = $this->app['repo.api-accounts']->findByUserAndApplication($user, $this->client)) {
|
||||
$account = $this->app['manipulator.api-account']->create($this->client, $user);
|
||||
$account = $this->app['manipulator.api-account']->create($this->client, $user, $this->getVariable('api_version', V2::VERSION));
|
||||
}
|
||||
|
||||
return $account;
|
||||
|
Reference in New Issue
Block a user