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]
authentication:
auto-create:
enabled: false
templates: { }
captcha:
enabled: true

View File

@@ -67,8 +67,10 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}
}, $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) {

View File

@@ -50,15 +50,15 @@ class patch_3817 implements patchInterface
{
$auth = $app['phraseanet.configuration']['authentication'];
if (!isset($auth['captcha'])) {
return true;
}
if (isset($auth['captcha']['trials-before-failure'])) {
if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) {
$auth['captcha']['trials-before-display'] = $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;
return true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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