Fix #1240 : Remove authentication>auto-create>enabled parameter

This commit is contained in:
Romain Neutron
2013-07-10 14:02:29 +02:00
parent 70cb9ee06b
commit c1347618ac
10 changed files with 22 additions and 33 deletions

View File

@@ -82,7 +82,6 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video] mediatypes: [Audio, Document, Flash, Image, Video]
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true

View File

@@ -67,8 +67,10 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
} }
}, $authConf['auto-create']['templates'])); }, $authConf['auto-create']['templates']));
$enabled = $app['phraseanet.registry']->get('GV_autoregister') && $app['registration.enabled'];
return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $authConf['auto-create']['enabled'], $templates); return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $enabled, $templates);
}); });
$app['authentication.providers'] = $app->share(function (Application $app) { $app['authentication.providers'] = $app->share(function (Application $app) {

View File

@@ -50,15 +50,15 @@ class patch_3817 implements patchInterface
{ {
$auth = $app['phraseanet.configuration']['authentication']; $auth = $app['phraseanet.configuration']['authentication'];
if (!isset($auth['captcha'])) { if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) {
return true;
}
if (isset($auth['captcha']['trials-before-failure'])) {
$auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure']; $auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure'];
unset($auth['captcha']['trials-before-failure']); unset($auth['captcha']['trials-before-failure']);
} }
if (isset($auth['auto-create']) && isset($auth['auto-create']['enabled'])) {
unset($auth['auto-create']['enabled']);
}
$app['phraseanet.configuration']['authentication'] = $auth; $app['phraseanet.configuration']['authentication'] = $auth;
return true; return true;

View File

@@ -85,7 +85,6 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video] mediatypes: [Audio, Document, Flash, Image, Video]
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true

View File

@@ -68,7 +68,6 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video] mediatypes: [Audio, Document, Flash, Image, Video]
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true
@@ -116,8 +115,6 @@ registration-fields:
required: true required: true
xsendfile: xsendfile:
enabled: false enabled: false
type: '' type: nginx
mapping: mapping: []
- plugins: []
directory: ''
mount-point: ''

View File

@@ -68,7 +68,6 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video] mediatypes: [Audio, Document, Flash, Image, Video]
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true
@@ -116,8 +115,6 @@ registration-fields:
required: true required: true
xsendfile: xsendfile:
enabled: false enabled: false
type: '' type: nginx
mapping: mapping: []
- plugins: []
directory: ''
mount-point: ''

View File

@@ -93,7 +93,6 @@ border-manager:
- Video - Video
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true

View File

@@ -93,7 +93,6 @@ border-manager:
- Video - Video
authentication: authentication:
auto-create: auto-create:
enabled: false
templates: { } templates: { }
captcha: captcha:
enabled: true enabled: true

View File

@@ -107,12 +107,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$app = new PhraseaApplication(); $app = new PhraseaApplication();
$app->register(new ConfigurationServiceProvider()); $app->register(new ConfigurationServiceProvider());
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['auto-create'] = array( $conf['authentication']['auto-create'] = array(
'enabled' => true,
'templates' => array(), 'templates' => array(),
); );
$app['phraseanet.configuration'] = $conf; $app['phraseanet.configuration']->setConfig($conf);
$app['authentication.providers.account-creator']; $app['authentication.providers.account-creator'];
} }
@@ -139,11 +138,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
})); }));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['captcha'] = array( $conf['authentication']['captcha'] = array(
'enabled' => true, 'enabled' => true,
); );
$app['phraseanet.configuration'] = $conf; $app['phraseanet.configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -177,11 +176,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
})); }));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['captcha'] = array( $conf['authentication']['captcha'] = array(
'enabled' => false, 'enabled' => false,
); );
$app['phraseanet.configuration'] = $conf; $app['phraseanet.configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
@@ -203,15 +202,14 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false); $template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false);
$template2->set_template(self::$DI['user']); $template2->set_template(self::$DI['user']);
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['auto-create'] = array( $conf['authentication']['auto-create'] = array(
'enabled' => true,
'templates' => array( 'templates' => array(
$template1->get_id(), $template1->get_id(),
$template2->get_login() $template2->get_login()
) )
); );
$app['phraseanet.configuration'] = $conf; $app['phraseanet.configuration']->setConfig($conf);
$this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates()); $this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates());

View File

@@ -202,7 +202,6 @@ class Migration38Test extends AbstractSetupTester
), ),
'authentication' => array( 'authentication' => array(
'auto-create' => array( 'auto-create' => array(
'enabled' => false,
'templates' => array( 'templates' => array(
), ),
), ),