From ed6c50f4fda9b288a255bc57f0d421f0b91f3be6 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Nov 2014 14:37:42 +0000 Subject: [PATCH 1/4] Fixed the proxy-manager version constraint --- composer.json | 2 +- src/Symfony/Bridge/ProxyManager/composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 306e9c981a..4cb0f42449 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,7 @@ "monolog/monolog": "~1.3", "propel/propel1": "~1.6", "ircmaxell/password-compat": "~1.0", - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + "ocramius/proxy-manager": "~0.3.1" }, "autoload": { "psr-0": { "Symfony\\": "src/" }, diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index 449553c0f3..9c61d2d98e 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.3", "symfony/dependency-injection": "~2.3", - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + "ocramius/proxy-manager": "~0.3.1" }, "require-dev": { "symfony/config": "~2.3" From 1270327d8318b906084fd6ddf65d3edac5d9e861 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Tue, 9 Dec 2014 12:18:23 +0000 Subject: [PATCH 2/4] Fixed the AuthenticationProviderInterface alignment --- .../Provider/AuthenticationProviderInterface.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php index 8007234175..adad258ee0 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php @@ -24,12 +24,12 @@ use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterfac */ interface AuthenticationProviderInterface extends AuthenticationManagerInterface { - /** - * Checks whether this provider supports the given token. - * - * @param TokenInterface $token A TokenInterface instance - * - * @return bool true if the implementation supports the Token, false otherwise - */ - public function supports(TokenInterface $token); + /** + * Checks whether this provider supports the given token. + * + * @param TokenInterface $token A TokenInterface instance + * + * @return bool true if the implementation supports the Token, false otherwise + */ + public function supports(TokenInterface $token); } From a8b8d33e942566fb858e78d35aa843d7fe77cb11 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Sat, 29 Nov 2014 18:22:43 +0000 Subject: [PATCH 3/4] [Filesystem] symlink use RealPath instead LinkTarget --- .../Component/Filesystem/Filesystem.php | 2 +- .../Filesystem/Tests/FilesystemTest.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 34b82cfd97..bcb70a336e 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -405,7 +405,7 @@ class Filesystem } } else { if (is_link($file)) { - $this->symlink($file->getLinkTarget(), $target); + $this->symlink($file->getRealPath(), $target); } elseif (is_dir($file)) { $this->mkdir($target); } elseif (is_file($file)) { diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index e957edfbb1..0b00911d17 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -899,6 +899,31 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); } + public function testMirrorCopiesRelativeLinkedContents() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $oldPath = getcwd(); + + mkdir($sourcePath.'nested/', 0777, true); + file_put_contents($sourcePath.'/nested/file1.txt', 'FILE1'); + // Note: Create relative symlink + chdir($sourcePath); + symlink('nested', 'link1'); + + chdir($oldPath); + + $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + + $this->filesystem->mirror($sourcePath, $targetPath); + + $this->assertTrue(is_dir($targetPath)); + $this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt'); + $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); + $this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1')); + } + /** * @dataProvider providePathsForIsAbsolutePath */ From c3c904d01ff24b7f00296e2d0bc52e9860a08a7d Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Mon, 3 Nov 2014 18:14:44 +0100 Subject: [PATCH 4/4] [SecurityBundle] Firewall providers building - code cleaning --- .../DependencyInjection/SecurityExtension.php | 30 ++----------------- .../Fixtures/UserProvider/DummyProvider.php | 25 ++++++++++++++++ .../SecurityExtensionTest.php | 28 +++++++++++++++++ 3 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/UserProvider/DummyProvider.php diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 336f9de024..23ad0a8700 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -495,6 +495,7 @@ class SecurityExtension extends Extension { $name = $this->getUserProviderId(strtolower($name)); + // Doctrine Entity and In-memory DAO provider are managed by factories foreach ($this->userProviderFactories as $factory) { $key = str_replace('-', '_', $factory->getKey()); @@ -521,37 +522,12 @@ class SecurityExtension extends Extension $container ->setDefinition($name, new DefinitionDecorator('security.user.provider.chain')) - ->addArgument($providers) - ; + ->addArgument($providers); return $name; } - // Doctrine Entity DAO provider - if (isset($provider['entity'])) { - $container - ->setDefinition($name, new DefinitionDecorator('security.user.provider.entity')) - ->addArgument($provider['entity']['class']) - ->addArgument($provider['entity']['property']) - ; - - return $name; - } - - // In-memory DAO provider - $definition = $container->setDefinition($name, new DefinitionDecorator('security.user.provider.in_memory')); - foreach ($provider['users'] as $username => $user) { - $userId = $name.'_'.$username; - - $container - ->setDefinition($userId, new DefinitionDecorator('security.user.provider.in_memory.user')) - ->setArguments(array($username, (string) $user['password'], $user['roles'])) - ; - - $definition->addMethodCall('createUser', array(new Reference($userId))); - } - - return $name; + throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name)); } private function getUserProviderId($name) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/UserProvider/DummyProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/UserProvider/DummyProvider.php new file mode 100644 index 0000000000..f40f11c3cc --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/UserProvider/DummyProvider.php @@ -0,0 +1,25 @@ +compile(); } + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage Unable to create definition for "security.user.provider.concrete.my_foo" user provider + */ + public function testFirewallWithInvalidUserProvider() + { + $container = $this->getRawContainer(); + + $extension = $container->getExtension('security'); + $extension->addUserProviderFactory(new DummyProvider()); + + $container->loadFromExtension('security', array( + 'providers' => array( + 'my_foo' => array('foo' => []), + ), + + 'firewalls' => array( + 'some_firewall' => array( + 'pattern' => '/.*', + 'http_basic' => [], + ), + ), + )); + + $container->compile(); + } + protected function getRawContainer() { $container = new ContainerBuilder();