mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Merge branch '3.8'
Conflicts: composer.lock
This commit is contained in:
17
.travis.yml
17
.travis.yml
@@ -1,13 +1,15 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
|
env:
|
||||||
|
- SETUP_MODE=update
|
||||||
|
- SETUP_MODE=install
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- rm -f config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old
|
- rm -f config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old
|
||||||
- cp -f hudson/connexion.inc config/
|
|
||||||
- cp -f hudson/_GV.php config/
|
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
- npm --version
|
||||||
- npm install
|
- npm install
|
||||||
@@ -27,7 +29,6 @@ before_script:
|
|||||||
- mysql -e 'create database ab_test;create database db_test; create database ab_unitTests; create database db_unitTests;'
|
- mysql -e 'create database ab_test;create database db_test; create database ab_unitTests; create database db_unitTests;'
|
||||||
- sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION"
|
- sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION"
|
||||||
- sudo mysql -e "GRANT ALL PRIVILEGES ON db_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION"
|
- sudo mysql -e "GRANT ALL PRIVILEGES ON db_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION"
|
||||||
- mysql -e "source `pwd`/hudson/fixtures.sql"
|
|
||||||
- mysql -e 'SET @@global.sql_mode= "";'
|
- mysql -e 'SET @@global.sql_mode= "";'
|
||||||
- mysql -e 'SET @@global.wait_timeout= 999999;'
|
- mysql -e 'SET @@global.wait_timeout= 999999;'
|
||||||
- git clone git://github.com/alchemy-fr/Phraseanet-Extension.git
|
- git clone git://github.com/alchemy-fr/Phraseanet-Extension.git
|
||||||
@@ -56,7 +57,15 @@ php:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- bin/developer dependencies:all --prefer-source
|
- bin/developer dependencies:all --prefer-source
|
||||||
- bin/setup system:upgrade -y -v -f
|
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
||||||
|
cp hudson/connexion.inc config/;
|
||||||
|
cp hudson/_GV.php config/;
|
||||||
|
mysql -e 'source `pwd`/hudson/fixtures.sql';
|
||||||
|
bin/setup system:upgrade -y -v -f;
|
||||||
|
fi"
|
||||||
|
- sh -c " if [ '$SETUP_MODE' = 'install' ]; then
|
||||||
|
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y;
|
||||||
|
fi"
|
||||||
- php hudson/cleanupSubdefs.php
|
- php hudson/cleanupSubdefs.php
|
||||||
- grunt test
|
- grunt test
|
||||||
- bin/phpunit
|
- bin/phpunit
|
||||||
|
@@ -90,9 +90,9 @@ class Oauth2 implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app));
|
$app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app));
|
||||||
} else {
|
|
||||||
return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if current client is already authorized by current user
|
//check if current client is already authorized by current user
|
||||||
@@ -128,9 +128,13 @@ class Oauth2 implements ControllerProviderInterface
|
|||||||
$params = $oauth2_adapter->finishNativeClientAuthorization($app_authorized, $params);
|
$params = $oauth2_adapter->finishNativeClientAuthorization($app_authorized, $params);
|
||||||
|
|
||||||
return new Response($app['twig']->render("api/auth/native_app_access_token.html.twig", $params));
|
return new Response($app['twig']->render("api/auth/native_app_access_token.html.twig", $params));
|
||||||
} else {
|
|
||||||
$oauth2_adapter->finishClientAuthorization($app_authorized, $params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oauth2_adapter->finishClientAuthorization($app_authorized, $params);
|
||||||
|
|
||||||
|
// As OAuth2 library already outputs response content, we need to send an empty
|
||||||
|
// response to avoid breaking silex controller
|
||||||
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
$controllers->match('/authorize', $authorize_func)
|
$controllers->match('/authorize', $authorize_func)
|
||||||
@@ -150,7 +154,9 @@ class Oauth2 implements ControllerProviderInterface
|
|||||||
ob_flush();
|
ob_flush();
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
return;
|
// As OAuth2 library already outputs response content, we need to send an empty
|
||||||
|
// response to avoid breaking silex controller
|
||||||
|
return '';
|
||||||
});
|
});
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
|
@@ -258,7 +258,7 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
protected function setAccessToken($oauth_token, $account_id, $expires, $scope = NULL)
|
protected function setAccessToken($oauth_token, $account_id, $expires, $scope = NULL)
|
||||||
{
|
{
|
||||||
$account = new API_OAuth2_Account($this->app, $account_id);
|
$account = new API_OAuth2_Account($this->app, $account_id);
|
||||||
$token = API_OAuth2_Token::create($this->app, $account, $scope);
|
$token = API_OAuth2_Token::create($this->app['phraseanet.appbox'], $account, $scope);
|
||||||
$token->set_value($oauth_token)->set_expires($expires);
|
$token->set_value($oauth_token)->set_expires($expires);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -800,7 +800,7 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
try {
|
try {
|
||||||
$application = API_OAuth2_Application::load_from_client_id($this->app, $client_id);
|
$application = API_OAuth2_Application::load_from_client_id($this->app, $client_id);
|
||||||
|
|
||||||
$usr_id = $this->app['auth']->isValid($username, $password, Request::createFromGlobals());
|
$usr_id = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals());
|
||||||
|
|
||||||
if (!$usr_id) {
|
if (!$usr_id) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -99,8 +99,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
|
|||||||
{
|
{
|
||||||
$othercollection = $collection = null;
|
$othercollection = $collection = null;
|
||||||
$app = new Application('test');
|
$app = new Application('test');
|
||||||
|
$databoxes = $app['phraseanet.appbox']->get_databoxes();
|
||||||
|
if (count($databoxes) === 0) {
|
||||||
|
$this->fail('Unable to find collections');
|
||||||
|
}
|
||||||
|
$databox = array_pop($databoxes);
|
||||||
|
|
||||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $db) {
|
foreach ($databoxes as $db) {
|
||||||
if (! $collection) {
|
if (! $collection) {
|
||||||
foreach ($db->get_collections() as $coll) {
|
foreach ($db->get_collections() as $coll) {
|
||||||
$collection = $coll;
|
$collection = $coll;
|
||||||
@@ -118,6 +123,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $othercollection) {
|
||||||
|
$othercollection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
|
||||||
|
}
|
||||||
|
if (null === $collection) {
|
||||||
|
$collection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array(array($collection), $collection, true),
|
array(array($collection), $collection, true),
|
||||||
array($collection, $collection, true),
|
array($collection, $collection, true),
|
||||||
|
@@ -21,6 +21,8 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
// initialize record so that it already exist
|
||||||
|
$record = self::$DI['record_1'];
|
||||||
$this->object = new Filename(self::$DI['app']);
|
$this->object = new Filename(self::$DI['app']);
|
||||||
$this->filename = __DIR__ . '/../../../../../../tmp/test001.jpg';
|
$this->filename = __DIR__ . '/../../../../../../tmp/test001.jpg';
|
||||||
copy(__DIR__ . '/../../../../../files/test001.jpg', $this->filename);
|
copy(__DIR__ . '/../../../../../files/test001.jpg', $this->filename);
|
||||||
|
@@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||||
{
|
{
|
||||||
public static $demands;
|
public static $demands;
|
||||||
|
public static $collections;
|
||||||
public static $login;
|
public static $login;
|
||||||
public static $email;
|
public static $email;
|
||||||
|
|
||||||
@@ -26,6 +27,16 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
if (null === self::$demands) {
|
if (null === self::$demands) {
|
||||||
self::$demands = array(self::$DI['collection']->get_coll_id());
|
self::$demands = array(self::$DI['collection']->get_coll_id());
|
||||||
}
|
}
|
||||||
|
if (null === self::$collections) {
|
||||||
|
self::$collections = array(self::$DI['collection']->get_base_id());
|
||||||
|
|
||||||
|
$sxml = simplexml_load_string(self::$DI['collection']->get_prefs());
|
||||||
|
$sxml->caninscript = 1;
|
||||||
|
$dom = new \DOMDocument();
|
||||||
|
$dom->loadXML($sxml->asXML());
|
||||||
|
|
||||||
|
self::$DI['collection']->set_prefs($dom);
|
||||||
|
}
|
||||||
if (null === self::$login) {
|
if (null === self::$login) {
|
||||||
self::$login = self::$DI['user']->get_login();
|
self::$login = self::$DI['user']->get_login();
|
||||||
}
|
}
|
||||||
@@ -417,6 +428,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
*/
|
*/
|
||||||
public function testGetRegister($type, $message)
|
public function testGetRegister($type, $message)
|
||||||
{
|
{
|
||||||
|
self::$DI['app']['registration.enabled'] = true;
|
||||||
self::$DI['app']['authentication']->closeAccount();
|
self::$DI['app']['authentication']->closeAccount();
|
||||||
self::$DI['app']->addFlash($type, $message);
|
self::$DI['app']->addFlash($type, $message);
|
||||||
$crawler = self::$DI['client']->request('GET', '/login/register-classic/');
|
$crawler = self::$DI['client']->request('GET', '/login/register-classic/');
|
||||||
@@ -429,6 +441,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testGetRegisterWithRegisterIdBindDataToForm()
|
public function testGetRegisterWithRegisterIdBindDataToForm()
|
||||||
{
|
{
|
||||||
|
self::$DI['app']['registration.enabled'] = true;
|
||||||
self::$DI['app']['authentication']->closeAccount();
|
self::$DI['app']['authentication']->closeAccount();
|
||||||
|
|
||||||
$provider = $this->getMock('Alchemy\Phrasea\Authentication\Provider\ProviderInterface');
|
$provider = $this->getMock('Alchemy\Phrasea\Authentication\Provider\ProviderInterface');
|
||||||
@@ -485,6 +498,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
*/
|
*/
|
||||||
public function testPostRegisterbadArguments($parameters, $extraParameters, $errors)
|
public function testPostRegisterbadArguments($parameters, $extraParameters, $errors)
|
||||||
{
|
{
|
||||||
|
self::$DI['app']['registration.enabled'] = true;
|
||||||
self::$DI['app']['registration.fields'] = $extraParameters;
|
self::$DI['app']['registration.fields'] = $extraParameters;
|
||||||
|
|
||||||
self::$DI['app']['authentication']->closeAccount();
|
self::$DI['app']['authentication']->closeAccount();
|
||||||
|
@@ -566,6 +566,10 @@ var p4 = p4 || {};
|
|||||||
|
|
||||||
if (!frame.hasClass('closed'))
|
if (!frame.hasClass('closed'))
|
||||||
{
|
{
|
||||||
|
// hide tabs content
|
||||||
|
var activeTabIdx = $('#idFrameC .tabs').tabs("option", "active");
|
||||||
|
$('#idFrameC .tabs > div:eq('+activeTabIdx+')').hide();
|
||||||
|
|
||||||
frame.data('openwidth', frame.width());
|
frame.data('openwidth', frame.width());
|
||||||
frame.animate({width: 100},
|
frame.animate({width: 100},
|
||||||
300,
|
300,
|
||||||
@@ -595,6 +599,9 @@ var p4 = p4 || {};
|
|||||||
frame.removeClass('closed');
|
frame.removeClass('closed');
|
||||||
$('.escamote', frame).show();
|
$('.escamote', frame).show();
|
||||||
frame.unbind('click.escamote');
|
frame.unbind('click.escamote');
|
||||||
|
// show tabs content
|
||||||
|
var activeTabIdx = $('#idFrameC .tabs').tabs("option", "active");
|
||||||
|
$('#idFrameC .tabs > div:eq('+activeTabIdx+')').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user