diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php index 6b40c37243..379bce8412 100644 --- a/lib/Alchemy/Phrasea/Application/Api.php +++ b/lib/Alchemy/Phrasea/Application/Api.php @@ -85,6 +85,11 @@ return call_user_func(function() { throw new \API_V1_exception_forbidden(_('The use of phraseanet Navigator is not allowed')); } + if ($oAuth2App->get_client_id() == \API_OAuth2_Application_OfficePlugin::CLIENT_ID + && ! $registry->get('GV_client_officeplugin')) { + throw new \API_V1_exception_forbidden('The use of Office Plugin is not allowed.'); + } + if ($session->is_authenticated()) { $app['dispatcher']->dispatch(PhraseaEvents::API_OAUTH2_END, new ApiOAuth2EndEvent()); return; diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index d21d11cff5..9f29a5c00b 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.7.14'; + protected static $number = '3.7.15'; protected static $name = 'Carnosaurus'; public static function getNumber() diff --git a/lib/classes/API/OAuth2/Application/OfficePlugin.class.php b/lib/classes/API/OAuth2/Application/OfficePlugin.class.php new file mode 100644 index 0000000000..dbdcfe2cd4 --- /dev/null +++ b/lib/classes/API/OAuth2/Application/OfficePlugin.class.php @@ -0,0 +1,17 @@ + array( 'active' => $registry->get('GV_client_navigator'), ), + 'office-plugin' => array( + 'active' => $registry->get('GV_client_navigator'), + ), 'homepage' => array( 'viewType' => $registry->get('GV_home_publi'), ), diff --git a/lib/classes/patch/3715.class.php b/lib/classes/patch/3715.class.php new file mode 100644 index 0000000000..bce474913a --- /dev/null +++ b/lib/classes/patch/3715.class.php @@ -0,0 +1,71 @@ +release; + } + + public function require_all_upgrades() + { + return false; + } + + /** + * + * @return Array + */ + public function concern() + { + return $this->concern; + } + + /** + * @param base $databox + */ + public function apply(base &$appbox) + { + $appbox = \appbox::get_instance(\bootstrap::getCore()); + + try { + \API_OAuth2_Application::load_from_client_id($appbox, \API_OAuth2_Application_OfficePlugin::CLIENT_ID); + } catch (\Exception_NotFound $e) { + $client = \API_OAuth2_Application::create($appbox, null, \API_OAuth2_Application_OfficePlugin::CLIENT_NAME); + + $client->set_activated(true); + $client->set_grant_password(true); + $client->set_website("http://www.phraseanet.com"); + $client->set_client_id(\API_OAuth2_Application_OfficePlugin::CLIENT_ID); + $client->set_client_secret(\API_OAuth2_Application_OfficePlugin::CLIENT_SECRET); + $client->set_type(\API_OAuth2_Application::DESKTOP_TYPE); + $client->set_redirect_uri(\API_OAuth2_Application::NATIVE_APP_REDIRECT_URI); + } + + return true; + } +} diff --git a/lib/conf.d/_GV_template.inc b/lib/conf.d/_GV_template.inc index dfe7a4f001..c5b33e0520 100644 --- a/lib/conf.d/_GV_template.inc +++ b/lib/conf.d/_GV_template.inc @@ -246,6 +246,13 @@ $GV = array( 'default' => true, 'required' => true ), + array( + 'type' => \registry::TYPE_BOOLEAN, + 'name' => 'GV_client_officeplugin', + 'comment' => _('Authorize Microsoft Office Plugin to connect.'), + 'default' => true, + 'required' => true + ), ) ), array( 'section' => _('GV::section:: Gestionnaire d\'evenements'), diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index 46f6015c95..2aa1517823 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -387,6 +387,22 @@ 1 1 + + null + null + desktop + office-plugin + + http://www.phraseanet.com + NOW() + NOW() + \alchemy\phraseanet\id\999585175b5fbb6e140efbdfea86c561 + \alchemy\phraseanet\secret\6d53d0bc74e6c8c1a325541f71da1ea5 + AfCF61 + urn:ietf:wg:oauth:2.0:oob + 1 + 1 + InnoDB