mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00
add token for adobe cc plugin
This commit is contained in:
@@ -251,6 +251,21 @@ class RegenerateSqliteDb extends Command
|
|||||||
$application->setClientSecret(\API_OAuth2_Application_OfficePlugin::CLIENT_SECRET);
|
$application->setClientSecret(\API_OAuth2_Application_OfficePlugin::CLIENT_SECRET);
|
||||||
|
|
||||||
$this->container['manipulator.api-application']->update($application);
|
$this->container['manipulator.api-application']->update($application);
|
||||||
|
|
||||||
|
$application = $this->container['manipulator.api-application']->create(
|
||||||
|
\API_OAuth2_Application_AdobeCCPlugin::CLIENT_NAME,
|
||||||
|
ApiApplication::DESKTOP_TYPE,
|
||||||
|
'',
|
||||||
|
'http://www.phraseanet.com',
|
||||||
|
null,
|
||||||
|
ApiApplication::NATIVE_APP_REDIRECT_URI
|
||||||
|
);
|
||||||
|
|
||||||
|
$application->setGrantPassword(true);
|
||||||
|
$application->setClientId(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_ID);
|
||||||
|
$application->setClientSecret(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_SECRET);
|
||||||
|
|
||||||
|
$this->container['manipulator.api-application']->update($application);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function insertAuthFailures(EntityManager $em, \Pimple $DI)
|
private function insertAuthFailures(EntityManager $em, \Pimple $DI)
|
||||||
|
@@ -89,6 +89,12 @@ class OAuthListener
|
|||||||
return Result::createError($request, 403, 'The use of Office Plugin is not allowed.')->createResponse();
|
return Result::createError($request, 403, 'The use of Office Plugin is not allowed.')->createResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oAuth2App->getClientId() == \API_OAuth2_Application_AdobeCCPlugin::CLIENT_ID
|
||||||
|
&& !$conf->get(['registry', 'api-clients', 'adobe_cc-enabled'])
|
||||||
|
) {
|
||||||
|
return Result::createError($request, 403, 'The use of AdobeCC Plugin is not allowed.')->createResponse();
|
||||||
|
}
|
||||||
|
|
||||||
$authentication = $this->getAuthenticator($app);
|
$authentication = $this->getAuthenticator($app);
|
||||||
|
|
||||||
if ($authentication->isAuthenticated()) {
|
if ($authentication->isAuthenticated()) {
|
||||||
|
@@ -38,6 +38,7 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$this->createNavigatorApplication();
|
$this->createNavigatorApplication();
|
||||||
$this->createOfficePluginApplication();
|
$this->createOfficePluginApplication();
|
||||||
|
$this->createAdobeCCPluginApplication();
|
||||||
$this->generateProxies();
|
$this->generateProxies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +78,24 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface
|
|||||||
$this->app['manipulator.api-application']->update($application);
|
$this->app['manipulator.api-application']->update($application);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createAdobeCCPluginApplication()
|
||||||
|
{
|
||||||
|
$application = $this->app['manipulator.api-application']->create(
|
||||||
|
\API_OAuth2_Application_AdobeCCPlugin::CLIENT_NAME,
|
||||||
|
ApiApplication::DESKTOP_TYPE,
|
||||||
|
'',
|
||||||
|
'http://www.phraseanet.com',
|
||||||
|
null,
|
||||||
|
ApiApplication::NATIVE_APP_REDIRECT_URI
|
||||||
|
);
|
||||||
|
|
||||||
|
$application->setGrantPassword(true);
|
||||||
|
$application->setClientId(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_ID);
|
||||||
|
$application->setClientSecret(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_SECRET);
|
||||||
|
|
||||||
|
$this->app['manipulator.api-application']->update($application);
|
||||||
|
}
|
||||||
|
|
||||||
private function generateProxies()
|
private function generateProxies()
|
||||||
{
|
{
|
||||||
$process = new Process('php ' . $this->app['root.path']. '/bin/developer orm:generate:proxies');
|
$process = new Process('php ' . $this->app['root.path']. '/bin/developer orm:generate:proxies');
|
||||||
|
@@ -16,7 +16,7 @@ class Version
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $number = '4.1.0-alpha.9';
|
private $number = '4.1.0-alpha.10';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
17
lib/classes/API/OAuth2/Application/AdobeCCPlugin.php
Normal file
17
lib/classes/API/OAuth2/Application/AdobeCCPlugin.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2016 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class API_OAuth2_Application_AdobeCCPlugin
|
||||||
|
{
|
||||||
|
const CLIENT_ID = '\alchemy\phraseanet\id\YZWUTqNyq8ObG4b0o4sp7NX50ScudqiV';
|
||||||
|
const CLIENT_SECRET = '\alchemy\phraseanet\secret\nEpZd3O6Mk2ijQWiXsm7wPNKnFrbv7MO';
|
||||||
|
const CLIENT_NAME = 'adobe_cc-plugin';
|
||||||
|
}
|
88
lib/classes/patch/410alpha10a.php
Normal file
88
lib/classes/patch/410alpha10a.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2016 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||||
|
use Alchemy\Phrasea\Model\Manipulator\ApiApplicationManipulator;
|
||||||
|
use Alchemy\Phrasea\Model\Entities\ApiApplication;
|
||||||
|
use Alchemy\Phrasea\Model\Repositories\ApiApplicationRepository;
|
||||||
|
|
||||||
|
|
||||||
|
class patch_410alpha10a implements patchInterface
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $release = '4.1.0-alpha.10';
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $concern = [base::APPLICATION_BOX];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function get_release()
|
||||||
|
{
|
||||||
|
return $this->release;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getDoctrineMigrations()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function apply(base $databox, Application $app)
|
||||||
|
{
|
||||||
|
// create an api application for adobeCC
|
||||||
|
/** @var ApiApplicationRepository $repo */
|
||||||
|
$repo = $app['repo.api-applications'];
|
||||||
|
if(!$repo->findByClientId(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_ID)) {
|
||||||
|
|
||||||
|
/** @var ApiApplicationManipulator $manipulator */
|
||||||
|
$manipulator = $app['manipulator.api-application'];
|
||||||
|
|
||||||
|
$application = $manipulator->create(
|
||||||
|
\API_OAuth2_Application_AdobeCCPlugin::CLIENT_NAME,
|
||||||
|
ApiApplication::DESKTOP_TYPE,
|
||||||
|
'',
|
||||||
|
'http://www.phraseanet.com',
|
||||||
|
null,
|
||||||
|
ApiApplication::NATIVE_APP_REDIRECT_URI
|
||||||
|
);
|
||||||
|
|
||||||
|
$application->setGrantPassword(true);
|
||||||
|
$application->setClientId(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_ID);
|
||||||
|
$application->setClientSecret(\API_OAuth2_Application_AdobeCCPlugin::CLIENT_SECRET);
|
||||||
|
|
||||||
|
$manipulator->update($application);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user