# HG changeset patch # User ymh # Date 1317374693 -7200 # Node ID e54dfe4d0b2b20f0b4a1fb3f362b8fb8e763904e # Parent 806e57d670203842ff5f0a169101288e88047936 add FOSUserBundle diff -r 806e57d67020 -r e54dfe4d0b2b app/AppKernel.php --- a/app/AppKernel.php Wed Sep 28 17:45:50 2011 +0200 +++ b/app/AppKernel.php Fri Sep 30 11:24:53 2011 +0200 @@ -18,6 +18,8 @@ new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), new Company\BaseBundle\CompanyBaseBundle(), + new FOS\UserBundle\FOSUserBundle(), + new Company\UserBundle\CompanyUserBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff -r 806e57d67020 -r e54dfe4d0b2b app/autoload.php --- a/app/autoload.php Wed Sep 28 17:45:50 2011 +0200 +++ b/app/autoload.php Fri Sep 30 11:24:53 2011 +0200 @@ -14,6 +14,7 @@ 'Monolog' => __DIR__.'/../vendor/monolog/src', 'Assetic' => __DIR__.'/../vendor/assetic/src', 'Metadata' => __DIR__.'/../vendor/metadata/src', + 'FOS' => __DIR__.'/../vendor/bundles', )); $loader->registerPrefixes(array( 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib', diff -r 806e57d67020 -r e54dfe4d0b2b app/config/config.yml --- a/app/config/config.yml Wed Sep 28 17:45:50 2011 +0200 +++ b/app/config/config.yml Fri Sep 30 11:24:53 2011 +0200 @@ -57,3 +57,8 @@ jms_security_extra: secure_controllers: true secure_all_services: false + +fos_user: + db_driver: orm # other valid values are 'mongodb', 'couchdb' + firewall_name: main + user_class: Company\UserBundle\Entity\User diff -r 806e57d67020 -r e54dfe4d0b2b app/config/routing.yml --- a/app/config/routing.yml Wed Sep 28 17:45:50 2011 +0200 +++ b/app/config/routing.yml Fri Sep 30 11:24:53 2011 +0200 @@ -1,3 +1,7 @@ +CompanyUserBundle: + resource: "@CompanyUserBundle/Resources/config/routing.yml" + prefix: / + CompanyBaseBundle: resource: "@CompanyBaseBundle/Resources/config/routing.yml" prefix: / @@ -6,3 +10,22 @@ #_internal: # resource: "@FrameworkBundle/Resources/config/routing/internal.xml" # prefix: /_internal + +fos_user_security: + resource: "@FOSUserBundle/Resources/config/routing/security.xml" + +fos_user_profile: + resource: "@FOSUserBundle/Resources/config/routing/profile.xml" + prefix: /profile + +fos_user_register: + resource: "@FOSUserBundle/Resources/config/routing/registration.xml" + prefix: /register + +fos_user_resetting: + resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" + prefix: /resetting + +fos_user_change_password: + resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" + prefix: /change-password diff -r 806e57d67020 -r e54dfe4d0b2b app/config/security.yml --- a/app/config/security.yml Wed Sep 28 17:45:50 2011 +0200 +++ b/app/config/security.yml Fri Sep 30 11:24:53 2011 +0200 @@ -1,38 +1,58 @@ security: encoders: - Symfony\Component\Security\Core\User\User: plaintext + #Symfony\Component\Security\Core\User\User: plaintext + Company\UserBundle\Entity\User: sha512 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: - in_memory: - users: - user: { password: userpass, roles: [ 'ROLE_USER' ] } - admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } +# in_memory: +# users: +# user: { password: userpass, roles: [ 'ROLE_USER' ] } +# admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + fos_userbundle: + id: fos_user.user_manager firewalls: dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - login: - pattern: ^/demo/secured/login$ - security: false + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + main: + pattern: ^/ + form_login: + provider: fos_userbundle + logout: true + anonymous: true + - secured_area: - pattern: ^/demo/secured/ - form_login: - check_path: /demo/secured/login_check - login_path: /demo/secured/login - logout: - path: /demo/secured/logout - target: /demo/ +# login: +# pattern: ^/demo/secured/login$ +# security: false + +# secured_area: +# pattern: ^/demo/secured/ +# form_login: +# check_path: /demo/secured/login_check +# login_path: /demo/secured/login +# logout: +# path: /demo/secured/logout +# target: /demo/ #anonymous: ~ #http_basic: # realm: "Secured Demo Area" access_control: + - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/admin/, role: ROLE_ADMIN } + + role_hierarchy: + ROLE_ADMIN: ROLE_USER + ROLE_SUPER_ADMIN: ROLE_ADMIN + #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } #- { path: ^/_internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } diff -r 806e57d67020 -r e54dfe4d0b2b src/Company/UserBundle/CompanyUserBundle.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/UserBundle/CompanyUserBundle.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,9 @@ +processConfiguration($configuration, $configs); + + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yml'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b src/Company/UserBundle/DependencyInjection/Configuration.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/UserBundle/DependencyInjection/Configuration.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,29 @@ +root('company_user'); + + // Here you should define the parameters that are allowed to + // configure your bundle. See the documentation linked above for + // more information on that topic. + + return $treeBuilder; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b src/Company/UserBundle/Entity/User.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/UserBundle/Entity/User.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,44 @@ +id; + } + + /** + * The constructor + * Enter description here ... + */ + public function __construct() + { + parent::__construct(); + } +} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b src/Company/UserBundle/Resources/config/routing.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/UserBundle/Resources/config/routing.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,3 @@ +#CompanyUserBundle_homepage: +# pattern: /hello/{name} +# defaults: { _controller: CompanyUserBundle:Default:index } diff -r 806e57d67020 -r e54dfe4d0b2b src/Company/UserBundle/Resources/config/services.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/UserBundle/Resources/config/services.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +parameters: +# company_user.example.class: Company\UserBundle\Example + +services: +# company_user.example: +# class: %company_user.example.class% +# arguments: [@service_id, "plain_value", %parameter%] diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/.gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/.gitignore Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,4 @@ +phpunit.xml +Tests/autoload.php +nbproject +catalog.xml diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/ActivateUserCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/ActivateUserCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\User; + +/** + * @author Antoine Hérault + */ +class ActivateUserCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setName('fos:user:activate') + ->setDescription('Activate a user') + ->setDefinition(array( + new InputArgument('username', InputArgument::REQUIRED, 'The username'), + )) + ->setHelp(<<fos:user:activate command activates a user (so they will be able to log in): + + php app/console fos:user:activate matthieu +EOT + ); + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $username = $input->getArgument('username'); + + $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator'); + $manipulator->activate($username); + + $output->writeln(sprintf('User "%s" has been activated.', $username)); + } + + /** + * @see Command + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->getArgument('username')) { + $username = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a username:', + function($username) + { + if (empty($username)) { + throw new \Exception('Username can not be empty'); + } + return $username; + } + ); + $input->setArgument('username', $username); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/ChangePasswordCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/ChangePasswordCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\User; + +/** + * CreateUserCommand + */ +class ChangePasswordCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setName('fos:user:change-password') + ->setDescription('Change the password of a user.') + ->setDefinition(array( + new InputArgument('username', InputArgument::REQUIRED, 'The username'), + new InputArgument('password', InputArgument::REQUIRED, 'The password'), + )) + ->setHelp(<<fos:user:change-password command changes the password of a user: + + php app/console fos:user:change-password matthieu + +This interactive shell will first ask you for a password. + +You can alternatively specify the password as a second argument: + + php app/console fos:user:change-password matthieu mypassword + +EOT + ); + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $username = $input->getArgument('username'); + $password = $input->getArgument('password'); + + $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator'); + $manipulator->changePassword($username, $password); + + $output->writeln(sprintf('Changed password for user %s', $username)); + } + + /** + * @see Command + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->getArgument('username')) { + $username = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please give the username:', + function($username) + { + if (empty($username)) { + throw new \Exception('Username can not be empty'); + } + return $username; + } + ); + $input->setArgument('username', $username); + } + + if (!$input->getArgument('password')) { + $password = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please enter the new password:', + function($password) + { + if (empty($password)) { + throw new \Exception('Password can not be empty'); + } + return $password; + } + ); + $input->setArgument('password', $password); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/CreateUserCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/CreateUserCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\User; + +/** + * @author Matthieu Bontemps + * @author Thibault Duplessis + * @author Luis Cordova + */ +class CreateUserCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setName('fos:user:create') + ->setDescription('Create a user.') + ->setDefinition(array( + new InputArgument('username', InputArgument::REQUIRED, 'The username'), + new InputArgument('email', InputArgument::REQUIRED, 'The email'), + new InputArgument('password', InputArgument::REQUIRED, 'The password'), + new InputOption('super-admin', null, InputOption::VALUE_NONE, 'Set the user as super admin'), + new InputOption('inactive', null, InputOption::VALUE_NONE, 'Set the user as inactive'), + )) + ->setHelp(<<fos:user:create command creates a user: + + php app/console fos:user:create matthieu + +This interactive shell will ask you for an email and then a password. + +You can alternatively specify the email and password as the second and third arguments: + + php app/console fos:user:create matthieu matthieu@example.com mypassword + +You can create a super admin via the super-admin flag: + + php app/console fos:user:create admin --super-admin + +You can create an inactive user (will not be able to log in): + + php app/console fos:user:create thibault --inactive + +EOT + ); + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $username = $input->getArgument('username'); + $email = $input->getArgument('email'); + $password = $input->getArgument('password'); + $inactive = $input->getOption('inactive'); + $superadmin = $input->getOption('super-admin'); + + $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator'); + $manipulator->create($username, $password, $email, !$inactive, $superadmin); + + $output->writeln(sprintf('Created user %s', $username)); + } + + /** + * @see Command + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->getArgument('username')) { + $username = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a username:', + function($username) + { + if (empty($username)) { + throw new \Exception('Username can not be empty'); + } + return $username; + } + ); + $input->setArgument('username', $username); + } + + if (!$input->getArgument('email')) { + $email = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose an email:', + function($email) + { + if (empty($email)) { + throw new \Exception('Email can not be empty'); + } + return $email; + } + ); + $input->setArgument('email', $email); + } + + if (!$input->getArgument('password')) { + $password = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a password:', + function($password) + { + if (empty($password)) { + throw new \Exception('Password can not be empty'); + } + return $password; + } + ); + $input->setArgument('password', $password); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/DeactivateUserCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/DeactivateUserCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\User; + +/** + * @author Antoine Hérault + */ +class DeactivateUserCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setName('fos:user:deactivate') + ->setDescription('Deactivate a user') + ->setDefinition(array( + new InputArgument('username', InputArgument::REQUIRED, 'The username'), + )) + ->setHelp(<<fos:user:deactivate command deactivates a user (will not be able to log in) + + php app/console fos:user:deactivate matthieu +EOT + ); + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $username = $input->getArgument('username'); + + $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator'); + $manipulator->deactivate($username); + + $output->writeln(sprintf('User "%s" has been deactivated.', $username)); + } + + /** + * @see Command + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->getArgument('username')) { + $username = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a username:', + function($username) + { + if (empty($username)) { + throw new \Exception('Username can not be empty'); + } + return $username; + } + ); + $input->setArgument('username', $username); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/DemoteUserCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/DemoteUserCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Component\Console\Output\OutputInterface; +use FOS\UserBundle\Util\UserManipulator; + +/** + * @author Antoine Hérault + * @author Lenar Lõhmus + */ +class DemoteUserCommand extends RoleCommand +{ + /** + * @see Command + */ + protected function configure() + { + parent::configure(); + + $this + ->setName('fos:user:demote') + ->setDescription('Demote a user by removing a role') + ->setHelp(<<fos:user:demote command demotes a user by removing a role + + php app/console fos:user:demote matthieu ROLE_CUSTOM + php app/console fos:user:demote --super matthieu +EOT + ); + } + + protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role) + { + if ($super) { + $manipulator->demote($username); + $output->writeln(sprintf('User "%s" has been demoted as a simple user.', $username)); + } else { + if ($manipulator->removeRole($username, $role)) { + $output->writeln(sprintf('Role "%s" has been removed from user "%s".', $role, $username)); + } else { + $output->writeln(sprintf('User "%s" didn\'t have "%s" role.', $username, $role)); + } + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/PromoteUserCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/PromoteUserCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Component\Console\Output\OutputInterface; +use FOS\UserBundle\Util\UserManipulator; + +/** + * @author Matthieu Bontemps + * @author Thibault Duplessis + * @author Luis Cordova + * @author Lenar Lõhmus + */ +class PromoteUserCommand extends RoleCommand +{ + /** + * @see Command + */ + protected function configure() + { + parent::configure(); + + $this + ->setName('fos:user:promote') + ->setDescription('Promotes a user by adding a role') + ->setHelp(<<fos:user:promote command promotes a user by adding a role + + php app/console fos:user:promote matthieu ROLE_CUSTOM + php app/console fos:user:promote --super matthieu +EOT + ); + } + + protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role) + { + if ($super) { + $manipulator->promote($username); + $output->writeln(sprintf('User "%s" has been promoted as a super administrator.', $username)); + } else { + if ($added = $manipulator->addRole($username, $role)) { + $output->writeln(sprintf('Role "%s" has been added to user "%s".', $role, $username)); + } else { + $output->writeln(sprintf('User "%s" did already have "%s" role.', $username, $role)); + } + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Command/RoleCommand.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Command/RoleCommand.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\User; +use FOS\UserBundle\Util\UserManipulator; + +/** + * @author Lenar Lõhmus + */ +abstract class RoleCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setDefinition(array( + new InputArgument('username', InputArgument::REQUIRED, 'The username'), + new InputArgument('role', InputArgument::OPTIONAL, 'The role'), + new InputOption('super', null, InputOption::VALUE_NONE, 'Instead specifying role, use this to quickly add the super administrator role'), + )); + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $username = $input->getArgument('username'); + $role = $input->getArgument('role'); + $super = (true === $input->getOption('super')); + + if (null !== $role && $super) { + throw new \InvalidArgumentException('You can pass either the role or the --super option (but not both simultaneously).'); + } + + if (null === $role && !$super) { + throw new \RuntimeException('Not enough arguments.'); + } + + $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator'); + $this->executeRoleCommand($manipulator, $output, $username, $super, $role); + } + + /** + * @see Command + */ + abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role); + + /** + * @see Command + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + if (!$input->getArgument('username')) { + $username = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a username:', + function($username) + { + if (empty($username)) { + throw new \Exception('Username can not be empty'); + } + return $username; + } + ); + $input->setArgument('username', $username); + } + if ((true !== $input->getOption('super')) && !$input->getArgument('role')) { + $role = $this->getHelper('dialog')->askAndValidate( + $output, + 'Please choose a role:', + function($role) + { + if (empty($role)) { + throw new \Exception('Role can not be empty'); + } + return $role; + } + ); + $input->setArgument('role', $role); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/ChangePasswordController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/ChangePasswordController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use FOS\UserBundle\Model\UserInterface; + +/** + * Controller managing the password change + * + * @author Thibault Duplessis + * @author Christophe Coevoet + */ +class ChangePasswordController extends ContainerAware +{ + /** + * Change user password + */ + public function changePasswordAction() + { + $user = $this->container->get('security.context')->getToken()->getUser(); + if (!is_object($user) || !$user instanceof UserInterface) { + throw new AccessDeniedException('This user does not have access to this section.'); + } + + $form = $this->container->get('fos_user.change_password.form'); + $formHandler = $this->container->get('fos_user.change_password.form.handler'); + + $process = $formHandler->process($user); + if ($process) { + $this->setFlash('fos_user_success', 'change_password.flash.success'); + + return new RedirectResponse($this->getRedirectionUrl($user)); + } + + return $this->container->get('templating')->renderResponse( + 'FOSUserBundle:ChangePassword:changePassword.html.'.$this->container->getParameter('fos_user.template.engine'), + array('form' => $form->createView(), 'theme' => $this->container->getParameter('fos_user.template.theme')) + ); + } + + /** + * Generate the redirection url when the resetting is completed. + * + * @param UserInterface $user + * @return string + */ + protected function getRedirectionUrl(UserInterface $user) + { + return $this->container->get('router')->generate('fos_user_profile_show'); + } + + protected function setFlash($action, $value) + { + $this->container->get('session')->setFlash($action, $value); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/GroupController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/GroupController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; + +/** + * RESTful controller managing group CRUD + * + * @author Thibault Duplessis + * @author Christophe Coevoet + */ +class GroupController extends ContainerAware +{ + /** + * Show all groups + */ + public function listAction() + { + $groups = $this->container->get('fos_user.group_manager')->findGroups(); + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:list.html.'.$this->getEngine(), array('groups' => $groups)); + } + + /** + * Show one group + */ + public function showAction($groupname) + { + $group = $this->findGroupBy('name', $groupname); + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:show.html.'.$this->getEngine(), array('group' => $group)); + } + + /** + * Edit one group, show the edit form + */ + public function editAction($groupname) + { + $group = $this->findGroupBy('name', $groupname); + $form = $this->container->get('fos_user.group.form'); + $formHandler = $this->container->get('fos_user.group.form.handler'); + + $process = $formHandler->process($group); + if ($process) { + $this->setFlash('fos_user_success', 'group.flash.updated'); + $groupUrl = $this->container->get('router')->generate('fos_user_group_show', array('groupname' => $group->getName())); + + return new RedirectResponse($groupUrl); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:edit.html.'.$this->getEngine(), array( + 'form' => $form->createview(), + 'groupname' => $group->getName(), + 'theme' => $this->container->getParameter('fos_user.template.theme'), + )); + } + + /** + * Show the new form + */ + public function newAction() + { + $form = $this->container->get('fos_user.group.form'); + $formHandler = $this->container->get('fos_user.group.form.handler'); + + $process = $formHandler->process(); + if ($process) { + $this->setFlash('fos_user_success', 'group.flash.created'); + $parameters = array('groupname' => $form->getData('group')->getName()); + $url = $this->container->get('router')->generate('fos_user_group_show', $parameters); + + return new RedirectResponse($url); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:new.html.'.$this->getEngine(), array( + 'form' => $form->createview(), + 'theme' => $this->container->getParameter('fos_user.template.theme'), + )); + } + + /** + * Delete one group + */ + public function deleteAction($groupname) + { + $group = $this->findGroupBy('name', $groupname); + $this->container->get('fos_user.group_manager')->deleteGroup($group); + $this->setFlash('fos_user_success', 'group.flash.deleted'); + + return new RedirectResponse( $this->container->get('router')->generate('fos_user_group_list')); + } + + /** + * Find a group by a specific property + * + * @param string $key property name + * @param mixed $value property value + * @throws NotFoundException if user does not exist + * @return \FOS\UserBundle\Model\GroupInterface + */ + protected function findGroupBy($key, $value) + { + if (!empty($value)) { + $group = $this->container->get('fos_user.group_manager')->{'findGroupBy'.ucfirst($key)}($value); + } + + if (empty($group)) { + throw new NotFoundHttpException(sprintf('The group with "%s" does not exist for value "%s"', $key, $value)); + } + + return $group; + } + + protected function getEngine() + { + return $this->container->getParameter('fos_user.template.engine'); + } + + protected function setFlash($action, $value) + { + $this->container->get('session')->setFlash($action, $value); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/ProfileController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/ProfileController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use FOS\UserBundle\Model\UserInterface; + +/** + * Controller managing the user profile + * + * @author Christophe Coevoet + */ +class ProfileController extends ContainerAware +{ + /** + * Show the user + */ + public function showAction() + { + $user = $this->container->get('security.context')->getToken()->getUser(); + if (!is_object($user) || !$user instanceof UserInterface) { + throw new AccessDeniedException('This user does not have access to this section.'); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Profile:show.html.'.$this->container->getParameter('fos_user.template.engine'), array('user' => $user)); + } + + /** + * Edit the user + */ + public function editAction() + { + $user = $this->container->get('security.context')->getToken()->getUser(); + if (!is_object($user) || !$user instanceof UserInterface) { + throw new AccessDeniedException('This user does not have access to this section.'); + } + + $form = $this->container->get('fos_user.profile.form'); + $formHandler = $this->container->get('fos_user.profile.form.handler'); + + $process = $formHandler->process($user); + if ($process) { + $this->setFlash('fos_user_success', 'profile.flash.updated'); + + return new RedirectResponse($this->container->get('router')->generate('fos_user_profile_show')); + } + + return $this->container->get('templating')->renderResponse( + 'FOSUserBundle:Profile:edit.html.'.$this->container->getParameter('fos_user.template.engine'), + array('form' => $form->createView(), 'theme' => $this->container->getParameter('fos_user.template.theme')) + ); + } + + protected function setFlash($action, $value) + { + $this->container->get('session')->setFlash($action, $value); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/RegistrationController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/RegistrationController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use FOS\UserBundle\Model\UserInterface; + +/** + * Controller managing the registration + * + * @author Thibault Duplessis + * @author Christophe Coevoet + */ +class RegistrationController extends ContainerAware +{ + public function registerAction() + { + $form = $this->container->get('fos_user.registration.form'); + $formHandler = $this->container->get('fos_user.registration.form.handler'); + $confirmationEnabled = $this->container->getParameter('fos_user.registration.confirmation.enabled'); + + $process = $formHandler->process($confirmationEnabled); + if ($process) { + $user = $form->getData(); + + if ($confirmationEnabled) { + $this->container->get('session')->set('fos_user_send_confirmation_email/email', $user->getEmail()); + $route = 'fos_user_registration_check_email'; + } else { + $this->authenticateUser($user); + $route = 'fos_user_registration_confirmed'; + } + + $this->setFlash('fos_user_success', 'registration.flash.user_created'); + $url = $this->container->get('router')->generate($route); + + return new RedirectResponse($url); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array( + 'form' => $form->createView(), + 'theme' => $this->container->getParameter('fos_user.template.theme'), + )); + } + + /** + * Tell the user to check his email provider + */ + public function checkEmailAction() + { + $email = $this->container->get('session')->get('fos_user_send_confirmation_email/email'); + $this->container->get('session')->remove('fos_user_send_confirmation_email/email'); + $user = $this->container->get('fos_user.user_manager')->findUserByEmail($email); + + if (null === $user) { + throw new NotFoundHttpException(sprintf('The user with email "%s" does not exist', $email)); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:checkEmail.html.'.$this->getEngine(), array( + 'user' => $user, + )); + } + + /** + * Receive the confirmation token from user email provider, login the user + */ + public function confirmAction($token) + { + $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token); + + if (null === $user) { + throw new NotFoundHttpException(sprintf('The user with confirmation token "%s" does not exist', $token)); + } + + $user->setConfirmationToken(null); + $user->setEnabled(true); + + $this->container->get('fos_user.user_manager')->updateUser($user); + $this->authenticateUser($user); + + return new RedirectResponse($this->container->get('router')->generate('fos_user_registration_confirmed')); + } + + /** + * Tell the user his account is now confirmed + */ + public function confirmedAction() + { + $user = $this->container->get('security.context')->getToken()->getUser(); + if (!is_object($user) || !$user instanceof UserInterface) { + throw new AccessDeniedException('This user does not have access to this section.'); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:confirmed.html.'.$this->getEngine(), array( + 'user' => $user, + )); + } + + /** + * Authenticate a user with Symfony Security + * + * @param Boolean $reAuthenticate + */ + protected function authenticateUser(UserInterface $user) + { + $providerKey = $this->container->getParameter('fos_user.firewall_name'); + $token = new UsernamePasswordToken($user, null, $providerKey, $user->getRoles()); + + $this->container->get('security.context')->setToken($token); + } + + protected function setFlash($action, $value) + { + $this->container->get('session')->setFlash($action, $value); + } + + protected function getEngine() + { + return $this->container->getParameter('fos_user.template.engine'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/ResettingController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/ResettingController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,147 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use FOS\UserBundle\Model\UserInterface; + +/** + * Controller managing the resetting of the password + * + * @author Thibault Duplessis + * @author Christophe Coevoet + */ +class ResettingController extends ContainerAware +{ + /** + * Request reset user password: show form + */ + public function requestAction() + { + return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:request.html.'.$this->getEngine()); + } + + /** + * Request reset user password: submit form and send email + */ + public function sendEmailAction() + { + $username = $this->container->get('request')->request->get('username'); + + $user = $this->container->get('fos_user.user_manager')->findUserByUsernameOrEmail($username); + + if (null === $user){ + return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:request.html.'.$this->getEngine(), array('invalid_username' => $username)); + } + + if ($user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) { + return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:passwordAlreadyRequested.html.'.$this->getEngine()); + } + + $user->generateConfirmationToken(); + $this->container->get('session')->set('fos_user_send_resetting_email/email', $user->getEmail()); + $this->container->get('fos_user.mailer')->sendResettingEmailMessage($user); + $user->setPasswordRequestedAt(new \DateTime()); + $this->container->get('fos_user.user_manager')->updateUser($user); + + return new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_check_email')); + } + + /** + * Tell the user to check his email provider + */ + public function checkEmailAction() + { + $session = $this->container->get('session'); + $email = $session->get('fos_user_send_resetting_email/email'); + $session->remove('fos_user_send_resetting_email/email'); + $user = $this->container->get('fos_user.user_manager')->findUserByEmail($email); + if (empty($user)) { + return new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_request')); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:checkEmail.html.'.$this->getEngine(), array( + 'user' => $user, + )); + } + + /** + * Reset user password + */ + public function resetAction($token) + { + $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token); + + if (null === $user){ + throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token)); + } + + if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) { + return new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_request')); + } + + $form = $this->container->get('fos_user.resetting.form'); + $formHandler = $this->container->get('fos_user.resetting.form.handler'); + $process = $formHandler->process($user); + + if ($process) { + $this->authenticateUser($user); + + $this->setFlash('fos_user_success', 'resetting.flash.success'); + + return new RedirectResponse($this->getRedirectionUrl($user)); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:reset.html.'.$this->getEngine(), array( + 'token' => $token, + 'form' => $form->createView(), + 'theme' => $this->container->getParameter('fos_user.template.theme'), + )); + } + + /** + * Authenticate a user with Symfony Security + * + * @param UserInterface $user + */ + protected function authenticateUser(UserInterface $user) + { + $providerKey = $this->container->getParameter('fos_user.firewall_name'); + $token = new UsernamePasswordToken($user, null, $providerKey, $user->getRoles()); + + $this->container->get('security.context')->setToken($token); + } + + /** + * Generate the redirection url when the resetting is completed. + * + * @param UserInterface $user + * @return string + */ + protected function getRedirectionUrl(UserInterface $user) + { + return $this->container->get('router')->generate('fos_user_profile_show'); + } + + protected function setFlash($action, $value) + { + $this->container->get('session')->setFlash($action, $value); + } + + protected function getEngine() + { + return $this->container->getParameter('fos_user.template.engine'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Controller/SecurityController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Controller/SecurityController.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Controller; + +use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\Security\Core\SecurityContext; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +class SecurityController extends ContainerAware +{ + public function loginAction() + { + $request = $this->container->get('request'); + /* @var $request \Symfony\Component\HttpFoundation\Request */ + $session = $request->getSession(); + /* @var $session \Symfony\Component\HttpFoundation\Session */ + + // get the error if any (works with forward and redirect -- see below) + if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { + $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); + } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) { + $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); + $session->remove(SecurityContext::AUTHENTICATION_ERROR); + } else { + $error = ''; + } + + if ($error) { + // TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523) + $error = $error->getMessage(); + } + // last username entered by the user + $lastUsername = (null === $session) ? '' : $session->get(SecurityContext::LAST_USERNAME); + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Security:login.html.'.$this->container->getParameter('fos_user.template.engine'), array( + 'last_username' => $lastUsername, + 'error' => $error, + )); + } + + public function checkAction() + { + throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.'); + } + + public function logoutAction() + { + throw new \RuntimeException('You must activate the logout in your security firewall configuration.'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/CouchDocument/GroupManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/CouchDocument/GroupManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,90 @@ +dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * Deletes a group. + * + * @param GroupInterface $group + * @return void + */ + public function deleteGroup(GroupInterface $group) + { + $this->dm->remove($group); + $this->dm->flush(); + } + + /** + * Finds one group by the given criteria. + * + * @param array $criteria + * @return GroupInterface + */ + public function findGroupBy(array $criteria) + { + return $this->repository->findBy($criteria); + } + + /** + * Returns a collection with all user instances. + * + * @return \Traversable + */ + public function findGroups() + { + return $this->repository->findAll(); + } + + /** + * Returns the group's fully qualified class name. + * + * @return string + */ + public function getClass() + { + return $this->class; + } + + /** + * Updates a group. + * + * @param GroupInterface $group + */ + public function updateGroup(GroupInterface $group, $andFlush = true) + { + $this->dm->persist($group); + if ($andFlush) { + $this->dm->flush(); + } + } +} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/CouchDocument/UserListener.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/CouchDocument/UserListener.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,63 @@ +container = $container; + } + + public function getSubscribedEvents() + { + return array( + Event::prePersist, + Event::preUpdate, + ); + } + + public function prePersist(LifecycleEventArgs $args) + { + $this->handleEvent($args); + } + + public function preUpdate(LifecycleEventArgs $args) + { + $this->handleEvent($args); + } + + private function handleEvent(LifecycleEventArgs $args) + { + if (null === $this->userManager) { + $this->userManager = $this->container->get('fos_user.user_manager'); + } + + $document = $args->getDocument(); + if ($document instanceof UserInterface) { + $this->userManager->updateCanonicalFields($document); + $this->userManager->updatePassword($document); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/CouchDocument/UserManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/CouchDocument/UserManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,112 @@ +dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteUser(UserInterface $user) + { + $this->dm->remove($user); + $this->dm->flush(); + } + + /** + * {@inheritDoc} + */ + public function getClass() + { + return $this->class; + } + + /** + * {@inheritDoc} + */ + public function findUserBy(array $criteria) + { + return $this->repository->findOneBy($criteria); + } + + /** + * {@inheritDoc} + */ + public function findUsers() + { + return $this->repository->findAll(); + } + + /** + * Updates a user. + * + * @param UserInterface $user + * @param Boolean $andFlush Whether to flush the changes (default true) + */ + public function updateUser(UserInterface $user, $andFlush = true) + { + $this->updateCanonicalFields($user); + $this->updatePassword($user); + + $this->dm->persist($user); + if ($andFlush) { + $this->dm->flush(); + } + } + + /** + * {@inheritDoc} + */ + public function validateUnique(UserInterface $value, Constraint $constraint) + { + // for now unique checks are not implemented in Doctrine CouchDB yet + return true; + } + + public function reloadUser(UserInterface $user) + { + $this->dm->refresh($user); + } +} + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/DependencyInjection/Compiler/SecurityEncoderFactoryPass.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/DependencyInjection/Compiler/SecurityEncoderFactoryPass.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Alias; + +/** + * Overwrites the existing encoder factory and injects the old one in the FOSUserBundle implementation + * + * @author Christophe Coevoet + */ +class SecurityEncoderFactoryPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if ($container->hasAlias('security.encoder_factory')) { + // security.encoder_factory is an alias. + // Register a private alias for this service to inject it as the parent + $container->setAlias('fos_user.encoder_factory.parent', new Alias((string) $container->getAlias('security.encoder_factory'), false)); + } else { + // security.encoder_factory is a definition. + // Register it again as a private service to inject it as the parent + $definition = $container->getDefinition('security.encoder_factory'); + $definition->setPublic(false); + $container->setDefinition('fos_user.encoder_factory.parent', $definition); + } + + $container->setAlias('security.encoder_factory', 'fos_user.encoder_factory'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/DependencyInjection/Configuration.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/DependencyInjection/Configuration.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,267 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * This class contains the configuration information for the bundle + * + * This information is solely responsible for how the different configuration + * sections are normalized, and merged. + * + * @author Christophe Coevoet + */ +class Configuration implements ConfigurationInterface +{ + /** + * Generates the configuration tree. + * + * @return TreeBuilder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('fos_user'); + + $rootNode + ->children() + ->scalarNode('db_driver')->cannotBeOverwritten()->isRequired()->cannotBeEmpty()->end() + ->scalarNode('user_class')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('firewall_name')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('model_manager_name')->defaultNull()->end() + ->booleanNode('use_listener')->defaultTrue()->end() + ->booleanNode('use_username_form_type')->defaultTrue()->end() + ->arrayNode('from_email') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('address')->defaultValue('webmaster@example.com')->cannotBeEmpty()->end() + ->scalarNode('sender_name')->defaultValue('webmaster')->cannotBeEmpty()->end() + ->end() + ->end() + ->end(); + + $this->addProfileSection($rootNode); + $this->addChangePasswordSection($rootNode); + $this->addRegistrationSection($rootNode); + $this->addResettingSection($rootNode); + $this->addServiceSection($rootNode); + $this->addEncoderSection($rootNode); + $this->addTemplateSection($rootNode); + $this->addGroupSection($rootNode); + + return $treeBuilder; + } + + private function addProfileSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('profile') + ->addDefaultsIfNotSet() + ->canBeUnset() + ->children() + ->arrayNode('form') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('type')->defaultValue('fos_user_profile')->end() + ->scalarNode('handler')->defaultValue('fos_user.profile.form.handler.default')->end() + ->scalarNode('name')->defaultValue('fos_user_profile_form')->cannotBeEmpty()->end() + ->arrayNode('validation_groups') + ->prototype('scalar')->end() + ->defaultValue(array('Profile')) + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function addRegistrationSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('registration') + ->addDefaultsIfNotSet() + ->canBeUnset() + ->children() + ->arrayNode('confirmation') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('enabled')->defaultFalse()->end() + ->scalarNode('template')->defaultValue('FOSUserBundle:Registration:email.txt.twig')->end() + ->arrayNode('from_email') + ->canBeUnset() + ->children() + ->scalarNode('address')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('sender_name')->isRequired()->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('form') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('type')->defaultValue('fos_user_registration')->end() + ->scalarNode('handler')->defaultValue('fos_user.registration.form.handler.default')->end() + ->scalarNode('name')->defaultValue('fos_user_registration_form')->cannotBeEmpty()->end() + ->arrayNode('validation_groups') + ->prototype('scalar')->end() + ->defaultValue(array('Registration')) + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function addResettingSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('resetting') + ->addDefaultsIfNotSet() + ->canBeUnset() + ->children() + ->scalarNode('token_ttl')->defaultValue(86400)->end() + ->arrayNode('email') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('template')->defaultValue('FOSUserBundle:Resetting:email.txt.twig')->end() + ->arrayNode('from_email') + ->canBeUnset() + ->children() + ->scalarNode('address')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('sender_name')->isRequired()->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('form') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('type')->defaultValue('fos_user_resetting')->end() + ->scalarNode('handler')->defaultValue('fos_user.resetting.form.handler.default')->end() + ->scalarNode('name')->defaultValue('fos_user_resetting_form')->cannotBeEmpty()->end() + ->arrayNode('validation_groups') + ->prototype('scalar')->end() + ->defaultValue(array('ResetPassword')) + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function addChangePasswordSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('change_password') + ->addDefaultsIfNotSet() + ->canBeUnset() + ->children() + ->arrayNode('form') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('type')->defaultValue('fos_user_change_password')->end() + ->scalarNode('handler')->defaultValue('fos_user.change_password.form.handler.default')->end() + ->scalarNode('name')->defaultValue('fos_user_change_password_form')->cannotBeEmpty()->end() + ->arrayNode('validation_groups') + ->prototype('scalar')->end() + ->defaultValue(array('ChangePassword')) + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function addServiceSection(ArrayNodeDefinition $node) + { + $node + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('service') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('mailer')->defaultValue('fos_user.mailer.default')->end() + ->scalarNode('email_canonicalizer')->defaultValue('fos_user.util.email_canonicalizer.default')->end() + ->scalarNode('username_canonicalizer')->defaultValue('fos_user.util.username_canonicalizer.default')->end() + ->scalarNode('user_manager')->defaultValue('fos_user.user_manager.default')->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function addEncoderSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('encoder') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('algorithm')->defaultValue('sha512')->end() + ->booleanNode('encode_as_base64')->defaultFalse()->end() + ->scalarNode('iterations')->defaultValue(1)->end() + ->end() + ->end() + ->end(); + } + + private function addTemplateSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('template') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('engine')->defaultValue('twig')->end() + ->scalarNode('theme')->defaultValue('FOSUserBundle::form.html.twig')->end() + ->end() + ->end() + ->end(); + } + + private function addGroupSection(ArrayNodeDefinition $node) + { + $node + ->children() + ->arrayNode('group') + ->canBeUnset() + ->children() + ->scalarNode('group_class')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('group_manager')->defaultValue('fos_user.group_manager.default')->end() + ->arrayNode('form') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('type')->defaultValue('fos_user_group')->end() + ->scalarNode('handler')->defaultValue('fos_user.group.form.handler.default')->end() + ->scalarNode('name')->defaultValue('fos_user_group_form')->cannotBeEmpty()->end() + ->arrayNode('validation_groups') + ->prototype('scalar')->end() + ->defaultValue(array('Registration')) + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/DependencyInjection/FOSUserExtension.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/DependencyInjection/FOSUserExtension.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,207 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\Config\FileLocator; + +class FOSUserExtension extends Extension +{ + public function load(array $configs, ContainerBuilder $container) + { + $processor = new Processor(); + $configuration = new Configuration(); + + $config = $processor->processConfiguration($configuration, $configs); + + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + + if (!in_array(strtolower($config['db_driver']), array('orm', 'mongodb', 'couchdb'))) { + throw new \InvalidArgumentException(sprintf('Invalid db driver "%s".', $config['db_driver'])); + } + $loader->load(sprintf('%s.xml', $config['db_driver'])); + + foreach (array('validator', 'security', 'util', 'mailer') as $basename) { + $loader->load(sprintf('%s.xml', $basename)); + } + + $container->setAlias('fos_user.mailer', $config['service']['mailer']); + $container->setAlias('fos_user.util.email_canonicalizer', $config['service']['email_canonicalizer']); + $container->setAlias('fos_user.util.username_canonicalizer', $config['service']['username_canonicalizer']); + $container->setAlias('fos_user.user_manager', $config['service']['user_manager']); + + if ($config['use_listener']) { + switch ($config['db_driver']) { + case 'orm': + $container->getDefinition('fos_user.user_listener')->addTag('doctrine.event_subscriber'); + break; + + case 'mongodb': + $container->getDefinition('fos_user.user_listener')->addTag('doctrine.common.event_subscriber'); + break; + + case 'couchdb': + $container->getDefinition('fos_user.user_listener')->addTag('doctrine_couchdb.event_subscriber'); + break; + + default: + break; + } + } + if ($config['use_username_form_type']) { + $loader->load('username_form_type.xml'); + } + + $this->remapParametersNamespaces($config, $container, array( + '' => array( + 'firewall_name' => 'fos_user.firewall_name', + 'model_manager_name' => 'fos_user.model_manager_name', + 'user_class' => 'fos_user.model.user.class', + ), + 'encoder' => 'fos_user.encoder.%s', + 'template' => 'fos_user.template.%s', + )); + $container->setParameter( + 'fos_user.registration.confirmation.from_email', + array($config['from_email']['address'] => $config['from_email']['sender_name']) + ); + $container->setParameter( + 'fos_user.resetting.email.from_email', + array($config['from_email']['address'] => $config['from_email']['sender_name']) + ); + + // handle the MongoDB document manager name in a specific way as it does not have a registry to make it easy + // TODO: change it if https://github.com/symfony/DoctrineMongoDBBundle/pull/31 is merged + if ('mongodb' === $config['db_driver']) { + if (null === $config['model_manager_name']) { + $container->setAlias(new Alias('fos_user.document_manager', false), 'doctrine.odm.mongodb.document_manager'); + } else { + $container->setAlias(new Alias('fos_user.document_manager', false), sprintf('doctrine.odm.%s_mongodb.document_manager', $config['model_manager_name'])); + } + } + + if (!empty($config['profile'])) { + $loader->load('profile.xml'); + + $container->setAlias('fos_user.profile.form.handler', $config['profile']['form']['handler']); + unset($config['profile']['form']['handler']); + + $this->remapParametersNamespaces($config['profile'], $container, array( + 'form' => 'fos_user.profile.form.%s', + )); + } + + if (!empty($config['registration'])) { + $loader->load('registration.xml'); + + $container->setAlias('fos_user.registration.form.handler', $config['registration']['form']['handler']); + unset($config['registration']['form']['handler']); + + if (!empty($config['registration']['confirmation']['from_email'])) { + $container->setParameter( + 'fos_user.registration.confirmation.from_email', + array($config['registration']['confirmation']['from_email']['address'] => $config['registration']['confirmation']['from_email']['sender_name']) + ); + } + unset($config['registration']['confirmation']['from_email']); + + $this->remapParametersNamespaces($config['registration'], $container, array( + 'confirmation' => 'fos_user.registration.confirmation.%s', + 'form' => 'fos_user.registration.form.%s', + )); + } + + if (!empty($config['change_password'])) { + $loader->load('change_password.xml'); + + $container->setAlias('fos_user.change_password.form.handler', $config['change_password']['form']['handler']); + unset($config['change_password']['form']['handler']); + + $this->remapParametersNamespaces($config['change_password'], $container, array( + 'form' => 'fos_user.change_password.form.%s', + )); + } + + if (!empty($config['resetting'])) { + $loader->load('resetting.xml'); + + $container->setAlias('fos_user.resetting.form.handler', $config['resetting']['form']['handler']); + unset($config['resetting']['form']['handler']); + + if (!empty($config['resetting']['email']['from_email'])) { + $container->setParameter( + 'fos_user.resetting.email.from_email', + array($config['resetting']['email']['from_email']['address'] => $config['resetting']['email']['from_email']['sender_name']) + ); + } + unset($config['resetting']['email']['from_email']); + + $this->remapParametersNamespaces($config['resetting'], $container, array( + '' => array ( + 'token_ttl' => 'fos_user.resetting.token_ttl', + ), + 'email' => 'fos_user.resetting.email.%s', + 'form' => 'fos_user.resetting.form.%s', + )); + } + + if (!empty($config['group'])) { + $loader->load('group.xml'); + $loader->load(sprintf('%s_group.xml', $config['db_driver'])); + + $container->setAlias('fos_user.group_manager', $config['group']['group_manager']); + $container->setAlias('fos_user.group.form.handler', $config['group']['form']['handler']); + unset($config['group']['form']['handler']); + + $this->remapParametersNamespaces($config['group'], $container, array( + '' => array( + 'group_class' => 'fos_user.model.group.class', + ), + 'form' => 'fos_user.group.form.%s', + )); + } + } + + protected function remapParameters(array $config, ContainerBuilder $container, array $map) + { + foreach ($map as $name => $paramName) { + if (array_key_exists($name, $config)) { + $container->setParameter($paramName, $config[$name]); + } + } + } + + protected function remapParametersNamespaces(array $config, ContainerBuilder $container, array $namespaces) + { + foreach ($namespaces as $ns => $map) { + if ($ns) { + if (!array_key_exists($ns, $config)) { + continue; + } + $namespaceConfig = $config[$ns]; + } else { + $namespaceConfig = $config; + } + if (is_array($map)) { + $this->remapParameters($namespaceConfig, $container, $map); + } else { + foreach ($namespaceConfig as $name => $value) { + $container->setParameter(sprintf($map, $name), $value); + } + } + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Document/Group.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Document/Group.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +use FOS\UserBundle\Model\Group as BaseGroup; + +abstract class Group extends BaseGroup +{ +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Document/GroupManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Document/GroupManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +use FOS\UserBundle\Model\GroupInterface; +use Doctrine\ODM\MongoDB\DocumentManager; +use FOS\UserBundle\Model\GroupManager as BaseGroupManager; + +class GroupManager extends BaseGroupManager +{ + protected $dm; + protected $class; + protected $repository; + + public function __construct(DocumentManager $dm, $class) + { + $this->dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteGroup(GroupInterface $group) + { + $this->dm->remove($group); + $this->dm->flush(); + } + + /** + * {@inheritDoc} + */ + public function getClass() + { + return $this->class; + } + + /** + * {@inheritDoc} + */ + public function findGroupBy(array $criteria) + { + return $this->repository->findOneBy($criteria); + } + + /** + * {@inheritDoc} + */ + public function findGroups() + { + return $this->repository->findAll(); + } + + /** + * Updates a group. + * + * @param GroupInterface $group + * @param Boolean $andFlush Whether to flush the changes (default true) + */ + public function updateGroup(GroupInterface $group, $andFlush = true) + { + $this->dm->persist($group); + if ($andFlush) { + $this->dm->flush(); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Document/User.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Document/User.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +use FOS\UserBundle\Model\User as AbstractUser; + +abstract class User extends AbstractUser +{ +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Document/UserListener.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Document/UserListener.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +use Doctrine\Common\EventSubscriber; +use Doctrine\ODM\MongoDB\Events; +use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs; +use Doctrine\ODM\MongoDB\Event\PreUpdateEventArgs; +use FOS\UserBundle\Model\UserInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Doctrine MongoDB ODM listener updating the canonical fields and the password. + * + * @author Christophe Coevoet + */ +class UserListener implements EventSubscriber +{ + /** + * @var \FOS\UserBundle\Model\UserManagerInterface + */ + private $userManager; + + /** + * @var ContainerInterface + */ + private $container; + + /** + * Constructor + * + * @param ContainerInterface $container + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getSubscribedEvents() + { + return array( + Events::prePersist, + Events::preUpdate, + ); + } + + public function prePersist(LifecycleEventArgs $args) + { + $this->handleEvent($args); + } + + public function preUpdate(PreUpdateEventArgs $args) + { + $this->handleEvent($args); + } + + private function handleEvent(LifecycleEventArgs $args) + { + if (null === $this->userManager) { + $this->userManager = $this->container->get('fos_user.user_manager'); + } + + $entity = $args->getDocument(); + if ($entity instanceof UserInterface) { + $this->userManager->updateCanonicalFields($entity); + $this->userManager->updatePassword($entity); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Document/UserManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Document/UserManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,174 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +use Doctrine\ODM\MongoDB\DocumentManager; +use Doctrine\ODM\MongoDB\Proxy\Proxy; +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManager as BaseUserManager; +use FOS\UserBundle\Util\CanonicalizerInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Validator\Constraint; + +class UserManager extends BaseUserManager +{ + protected $dm; + protected $repository; + protected $class; + + /** + * Constructor. + * + * @param EncoderFactoryInterface $encoderFactory + * @param string $algorithm + * @param CanonicalizerInterface $usernameCanonicalizer + * @param CanonicalizerInterface $emailCanonicalizer + * @param DocumentManager $dm + * @param string $class + */ + public function __construct(EncoderFactoryInterface $encoderFactory, $algorithm, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, DocumentManager $dm, $class) + { + parent::__construct($encoderFactory, $algorithm, $usernameCanonicalizer, $emailCanonicalizer); + + $this->dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteUser(UserInterface $user) + { + $this->dm->remove($user); + $this->dm->flush(); + } + + /** + * {@inheritDoc} + */ + public function getClass() + { + return $this->class; + } + + /** + * {@inheritDoc} + */ + public function findUserBy(array $criteria) + { + return $this->repository->findOneBy($criteria); + } + + /** + * {@inheritDoc} + */ + public function findUsers() + { + return $this->repository->findAll(); + } + + /** + * {@inheritDoc} + */ + public function reloadUser(UserInterface $user) + { + $this->dm->refresh($user); + } + + /** + * Updates a user. + * + * @param UserInterface $user + * @param Boolean $andFlush Whether to flush the changes (default true) + */ + public function updateUser(UserInterface $user, $andFlush = true) + { + $this->updateCanonicalFields($user); + $this->updatePassword($user); + + $this->dm->persist($user); + if ($andFlush) { + $this->dm->flush(); + } + } + + /** + * {@inheritDoc} + */ + public function validateUnique(UserInterface $value, Constraint $constraint) + { + // Since we probably want to validate the canonical fields, + // we'd better make sure we have them. + $this->updateCanonicalFields($value); + + $classMetadata = $this->dm->getClassMetadata($this->class); + // TODO: ODM seems to be missing handling for multiple properties + // $fields = array_map('trim', explode(',', $constraint->property)); + $query = $this->getQueryArray($classMetadata, $value, $constraint->property); + + $document = $this->findUserBy($query); + if (null === $document) { + return true; + } + + // check if document in mongodb is the same document as the checked one + if ($document->isUser($value)) { + return true; + } + // check if returned document is proxy and initialize the minimum identifier if needed + if ($document instanceof Proxy) { + $classMetadata->setIdentifierValue($document, $document->__identifier); + } + // check if document has the same identifier as the current one + if ($classMetadata->getIdentifierValue($document) === $classMetadata->getIdentifierValue($value)) { + return true; + } + + return false; + } + + protected function getQueryArray($classMetadata, $value, $fieldName) + { + $field = $this->getFieldNameFromPropertyPath($fieldName); + if (!isset($classMetadata->fieldMappings[$field])) { + throw new \LogicException("Mapping for '$fieldName' doesn't exist for " . $this->class); + } + + $mapping = $classMetadata->fieldMappings[$field]; + if (isset($mapping['reference']) && $mapping['reference']) { + throw new \LogicException('Cannot determine uniqueness of referenced document values'); + } + + $criteria[$field] = $value instanceOf UserInterface ? $classMetadata->getFieldValue($value, $field) : $value; + + return $criteria; + } + + /** + * Returns the actual document field value. + * + * E.g. document.someVal -> document + * user.emails -> user + * username -> username + * + * @param string $field + * @return string + */ + protected function getFieldNameFromPropertyPath($field) + { + $pieces = explode('.', $field); + return $pieces[0]; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Entity/Group.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Entity/Group.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Entity; + +use FOS\UserBundle\Model\Group as BaseGroup; + +class Group extends BaseGroup +{ +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Entity/GroupManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Entity/GroupManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Entity; + +use FOS\UserBundle\Model\GroupInterface; +use Doctrine\ORM\EntityManager; +use FOS\UserBundle\Model\GroupManager as BaseGroupManager; + +class GroupManager extends BaseGroupManager +{ + protected $em; + protected $class; + protected $repository; + + public function __construct(EntityManager $em, $class) + { + $this->em = $em; + $this->repository = $em->getRepository($class); + + $metadata = $em->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteGroup(GroupInterface $group) + { + $this->em->remove($group); + $this->em->flush(); + } + + /** + * {@inheritDoc} + */ + public function getClass() + { + return $this->class; + } + + /** + * {@inheritDoc} + */ + public function findGroupBy(array $criteria) + { + return $this->repository->findOneBy($criteria); + } + + /** + * {@inheritDoc} + */ + public function findGroups() + { + return $this->repository->findAll(); + } + + /** + * Updates a group + * + * @param GroupInterface $group + * @param Boolean $andFlush Whether to flush the changes (default true) + * @return void + */ + public function updateGroup(GroupInterface $group, $andFlush = true) + { + $this->em->persist($group); + if ($andFlush) { + $this->em->flush(); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Entity/User.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Entity/User.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Entity; + +use FOS\UserBundle\Model\User as AbstractUser; + +abstract class User extends AbstractUser +{ +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Entity/UserListener.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Entity/UserListener.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Entity; + +use Doctrine\Common\EventSubscriber; +use Doctrine\ORM\Events; +use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PreUpdateEventArgs; +use FOS\UserBundle\Model\UserInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Doctrine ORM listener updating the canonical fields and the password. + * + * @author Christophe Coevoet + */ +class UserListener implements EventSubscriber +{ + /** + * @var \FOS\UserBundle\Model\UserManagerInterface + */ + private $userManager; + + /** + * @var ContainerInterface + */ + private $container; + + /** + * Constructor + * + * @param ContainerInterface $container + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getSubscribedEvents() + { + return array( + Events::prePersist, + Events::preUpdate, + ); + } + + public function prePersist(LifecycleEventArgs $args) + { + $this->handleEvent($args); + } + + public function preUpdate(PreUpdateEventArgs $args) + { + $this->handleEvent($args); + } + + private function handleEvent(LifecycleEventArgs $args) + { + if (null === $this->userManager) { + $this->userManager = $this->container->get('fos_user.user_manager'); + } + + $entity = $args->getEntity(); + if ($entity instanceof UserInterface) { + $this->userManager->updateCanonicalFields($entity); + $this->userManager->updatePassword($entity); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Entity/UserManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Entity/UserManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Entity; + +use Doctrine\ORM\EntityManager; +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManager as BaseUserManager; +use FOS\UserBundle\Util\CanonicalizerInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Validator\Constraint; + +class UserManager extends BaseUserManager +{ + protected $em; + protected $class; + protected $repository; + + /** + * Constructor. + * + * @param EncoderFactoryInterface $encoderFactory + * @param string $algorithm + * @param CanonicalizerInterface $usernameCanonicalizer + * @param CanonicalizerInterface $emailCanonicalizer + * @param EntityManager $em + * @param string $class + */ + public function __construct(EncoderFactoryInterface $encoderFactory, $algorithm, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, EntityManager $em, $class) + { + parent::__construct($encoderFactory, $algorithm, $usernameCanonicalizer, $emailCanonicalizer); + + $this->em = $em; + $this->repository = $em->getRepository($class); + + $metadata = $em->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteUser(UserInterface $user) + { + $this->em->remove($user); + $this->em->flush(); + } + + /** + * {@inheritDoc} + */ + public function getClass() + { + return $this->class; + } + + /** + * {@inheritDoc} + */ + public function findUserBy(array $criteria) + { + return $this->repository->findOneBy($criteria); + } + + /** + * {@inheritDoc} + */ + public function findUsers() + { + return $this->repository->findAll(); + } + + /** + * {@inheritDoc} + */ + public function reloadUser(UserInterface $user) + { + $this->em->refresh($user); + } + + /** + * Updates a user. + * + * @param UserInterface $user + * @param Boolean $andFlush Whether to flush the changes (default true) + */ + public function updateUser(UserInterface $user, $andFlush = true) + { + $this->updateCanonicalFields($user); + $this->updatePassword($user); + + $this->em->persist($user); + if ($andFlush) { + $this->em->flush(); + } + } + + /** + * {@inheritDoc} + */ + public function validateUnique(UserInterface $value, Constraint $constraint) + { + // Since we probably want to validate the canonical fields, + // we'd better make sure we have them. + $this->updateCanonicalFields($value); + + $fields = array_map('trim', explode(',', $constraint->property)); + $users = $this->findConflictualUsers($value, $fields); + + // there is no conflictual user + if (empty($users)) { + return true; + } + + // there is no conflictual user which is not the same as the value + if ($this->anyIsUser($value, $users)) { + return true; + } + + return false; + } + + /** + * Indicates whether the given user and all compared objects correspond to the same record. + * + * @param UserInterface $user + * @param array $comparisons + * @return Boolean + */ + protected function anyIsUser($user, array $comparisons) + { + foreach ($comparisons as $comparison) { + if (!$user->isUser($comparison)) { + return false; + } + } + + return true; + } + + /** + * Gets conflictual users for the given user and constraint. + * + * @param UserInterface $value + * @param array $fields + * @return array + */ + protected function findConflictualUsers($value, array $fields) + { + return $this->repository->findBy($this->getCriteria($value, $fields)); + } + + /** + * Gets the criteria used to find conflictual entities. + * + * @param UserInterface $value + * @param array $constraint + * @return array + */ + protected function getCriteria($value, array $fields) + { + $classMetadata = $this->em->getClassMetadata($this->class); + + $criteria = array(); + foreach ($fields as $field) { + if (!$classMetadata->hasField($field)) { + throw new \InvalidArgumentException(sprintf('The "%s" class metadata does not have any "%s" field or association mapping.', $this->class, $field)); + } + + $criteria[$field] = $classMetadata->getFieldValue($value, $field); + } + + return $criteria; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/FOSUserBundle.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/FOSUserBundle.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use FOS\UserBundle\DependencyInjection\Compiler\SecurityEncoderFactoryPass; + +/** + * @author Matthieu Bontemps + * @author Thibault Duplessis + */ +class FOSUserBundle extends Bundle +{ + /** + * {@inheritdoc} + */ + public function build(ContainerBuilder $container) + { + parent::build($container); + + $container->addCompilerPass(new SecurityEncoderFactoryPass()); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/DataTransformer/UsernameToUserTransformer.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/DataTransformer/UsernameToUserTransformer.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,62 @@ + + */ +class UsernameToUserTransformer implements DataTransformerInterface +{ + /** + * @var UserManagerInterface + */ + protected $userManager; + + public function __construct(UserManagerInterface $userManager) + { + $this->userManager = $userManager; + } + + /** + * Transforms a UserInterface instance to a username string + * + * @param mixed $value a UserInterface instance + * @return string the username + */ + public function transform($value) + { + if (null === $value) { + return null; + } + if (!$value instanceof UserInterface) { + throw new UnexpectedTypeException($value, 'FOS\UserBundle\Model\UserInterface'); + } + + return $value->getUsername(); + } + + /** + * Transforms a username to a UserInterface instance + * + * @param string $username + * @return UserInterface the corresponding user instance + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + if (!is_string($value)) { + throw new UnexpectedTypeException($value, 'string'); + } + + return $this->userManager->findUserByUsername($value); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Handler/ChangePasswordFormHandler.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Handler/ChangePasswordFormHandler.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Handler; + +use Symfony\Component\Form\Form; +use Symfony\Component\HttpFoundation\Request; + +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManagerInterface; +use FOS\UserBundle\Form\Model\ChangePassword; + +class ChangePasswordFormHandler +{ + protected $request; + protected $userManager; + protected $form; + + public function __construct(Form $form, Request $request, UserManagerInterface $userManager) + { + $this->form = $form; + $this->request = $request; + $this->userManager = $userManager; + } + + public function getNewPassword() + { + return $this->form->getData()->new; + } + + public function process(UserInterface $user) + { + $this->form->setData(new ChangePassword($user)); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + + if ($this->form->isValid()) { + $this->onSuccess($user); + + return true; + } + } + + return false; + } + + protected function onSuccess(UserInterface $user) + { + $user->setPlainPassword($this->getNewPassword()); + $this->userManager->updateUser($user); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Handler/GroupFormHandler.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Handler/GroupFormHandler.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Handler; + +use Symfony\Component\Form\Form; +use Symfony\Component\HttpFoundation\Request; + +use FOS\UserBundle\Model\GroupInterface; +use FOS\UserBundle\Model\GroupManagerInterface; + +class GroupFormHandler +{ + protected $request; + protected $groupManager; + protected $form; + + public function __construct(Form $form, Request $request, GroupManagerInterface $groupManager) + { + $this->form = $form; + $this->request = $request; + $this->groupManager = $groupManager; + } + + public function process(GroupInterface $group = null) + { + if (null === $group) { + $group = $this->groupManager->createGroup(''); + } + + $this->form->setData($group); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + + if ($this->form->isValid()) { + $this->onSuccess($group); + + return true; + } + } + + return false; + } + + protected function onSuccess(GroupInterface $group) + { + $this->groupManager->updateGroup($group); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Handler/ProfileFormHandler.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Handler/ProfileFormHandler.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Handler; + +use Symfony\Component\Form\Form; +use Symfony\Component\HttpFoundation\Request; + +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManagerInterface; +use FOS\UserBundle\Form\Model\CheckPassword; + +class ProfileFormHandler +{ + protected $request; + protected $userManager; + protected $form; + + public function __construct(Form $form, Request $request, UserManagerInterface $userManager) + { + $this->form = $form; + $this->request = $request; + $this->userManager = $userManager; + } + + public function process(UserInterface $user) + { + $this->form->setData(new CheckPassword($user)); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + + if ($this->form->isValid()) { + $this->onSuccess($user); + + return true; + } + + // Reloads the user to reset its username. This is needed when the + // username or password have been changed to avoid issues with the + // security layer. + $this->userManager->reloadUser($user); + } + + return false; + } + + protected function onSuccess(UserInterface $user) + { + $this->userManager->updateUser($user); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Handler/RegistrationFormHandler.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Handler/RegistrationFormHandler.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Handler; + +use Symfony\Component\Form\Form; +use Symfony\Component\HttpFoundation\Request; +use FOS\UserBundle\Model\UserManagerInterface; +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Mailer\MailerInterface; + +class RegistrationFormHandler +{ + protected $request; + protected $userManager; + protected $form; + protected $mailer; + + public function __construct(Form $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer) + { + $this->form = $form; + $this->request = $request; + $this->userManager = $userManager; + $this->mailer = $mailer; + } + + public function process($confirmation = false) + { + $user = $this->userManager->createUser(); + $this->form->setData($user); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + + if ($this->form->isValid()) { + $this->onSuccess($user, $confirmation); + + return true; + } + } + + return false; + } + + protected function onSuccess(UserInterface $user, $confirmation) + { + if ($confirmation) { + $user->setEnabled(false); + $this->mailer->sendConfirmationEmailMessage($user); + } else { + $user->setConfirmationToken(null); + $user->setEnabled(true); + } + + $this->userManager->updateUser($user); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Handler/ResettingFormHandler.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Handler/ResettingFormHandler.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Handler; + +use Symfony\Component\Form\Form; +use Symfony\Component\HttpFoundation\Request; + +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManagerInterface; +use FOS\UserBundle\Form\Model\ResetPassword; + +class ResettingFormHandler +{ + protected $request; + protected $userManager; + protected $form; + + public function __construct(Form $form, Request $request, UserManagerInterface $userManager) + { + $this->form = $form; + $this->request = $request; + $this->userManager = $userManager; + } + + public function getNewPassword() + { + return $this->form->getData()->new; + } + + public function process(UserInterface $user) + { + $this->form->setData(new ResetPassword()); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + + if ($this->form->isValid()) { + $this->onSuccess($user); + + return true; + } + } + + return false; + } + + protected function onSuccess(UserInterface $user) + { + $user->setPlainPassword($this->getNewPassword()); + $user->setConfirmationToken(null); + $user->setEnabled(true); + $this->userManager->updateUser($user); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Model/ChangePassword.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Model/ChangePassword.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Model; + +class ChangePassword extends CheckPassword +{ + /** + * @var string + */ + public $new; +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Model/CheckPassword.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Model/CheckPassword.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Model; + +use FOS\UserBundle\Model\UserInterface; + +class CheckPassword +{ + /** + * User whose password is changed + * + * @var UserInterface + */ + public $user; + + /** + * @var string + */ + public $current; + + public function __construct(UserInterface $user) + { + $this->user = $user; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Model/ResetPassword.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Model/ResetPassword.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Model; + +use FOS\UserBundle\Model\UserInterface; + +class ResetPassword +{ + /** + * @var string + */ + public $new; +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/ChangePasswordFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/ChangePasswordFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Type; + +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\AbstractType; + +class ChangePasswordFormType extends AbstractType +{ + public function buildForm(FormBuilder $builder, array $options) + { + $builder->add('current', 'password'); + $builder->add('new', 'repeated', array('type' => 'password')); + } + + public function getDefaultOptions(array $options) + { + return array('data_class' => 'FOS\UserBundle\Form\Model\ChangePassword'); + } + + public function getName() + { + return 'fos_user_change_password'; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/GroupFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/GroupFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilder; + +class GroupFormType extends AbstractType +{ + private $class; + + /** + * @param string $class The Group class name + */ + public function __construct($class) + { + $this->class = $class; + } + + public function buildForm(FormBuilder $builder, array $options) + { + $builder->add('name'); + } + + public function getDefaultOptions(array $options) + { + return array('data_class' => $this->class); + } + + public function getName() + { + return 'fos_user_group'; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/ProfileFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/ProfileFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilder; + +class ProfileFormType extends AbstractType +{ + private $class; + + /** + * @param string $class The User class name + */ + public function __construct($class) + { + $this->class = $class; + } + + public function buildForm(FormBuilder $builder, array $options) + { + $child = $builder->create('user', 'form', array('data_class' => $this->class)); + $this->buildUserForm($child, $options); + + $builder + ->add($child) + ->add('current', 'password') + ; + } + + public function getDefaultOptions(array $options) + { + return array('data_class' => 'FOS\UserBundle\Form\Model\CheckPassword'); + } + + public function getName() + { + return 'fos_user_profile'; + } + + /** + * Builds the embedded form representing the user. + * + * @param FormBuilder $builder + * @param array $options + */ + protected function buildUserForm(FormBuilder $builder, array $options) + { + $builder + ->add('username') + ->add('email', 'email') + ; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/RegistrationFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/RegistrationFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilder; + +class RegistrationFormType extends AbstractType +{ + private $class; + + /** + * @param string $class The User class name + */ + public function __construct($class) + { + $this->class = $class; + } + + public function buildForm(FormBuilder $builder, array $options) + { + $builder + ->add('username') + ->add('email', 'email') + ->add('plainPassword', 'repeated', array('type' => 'password')); + } + + public function getDefaultOptions(array $options) + { + return array('data_class' => $this->class); + } + + public function getName() + { + return 'fos_user_registration'; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/ResettingFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/ResettingFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilder; + +class ResettingFormType extends AbstractType +{ + public function buildForm(FormBuilder $builder, array $options) + { + $builder->add('new', 'repeated', array('type' => 'password')); + } + + public function getDefaultOptions(array $options) + { + return array('data_class' => 'FOS\UserBundle\Form\Model\ResetPassword'); + } + + public function getName() + { + return 'fos_user_resetting'; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Form/Type/UsernameFormType.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Form/Type/UsernameFormType.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,43 @@ + + */ +class UsernameFormType extends AbstractType +{ + /** + * @var UsernameToUserTransformer + */ + protected $usernameTransformer; + + public function __construct(UsernameToUserTransformer $usernameTransformer) + { + $this->usernameTransformer = $usernameTransformer; + } + + public function buildForm(FormBuilder $builder, array $options) + { + parent::buildForm($builder, $options); + + $builder->appendClientTransformer($this->usernameTransformer); + } + + public function getParent(array $options) + { + return 'text'; + } + + public function getName() + { + return 'fos_user_username'; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Mailer/Mailer.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Mailer/Mailer.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Mailer; + +use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; +use Symfony\Component\Routing\RouterInterface; +use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Mailer\MailerInterface; + +/** + * @author Thibault Duplessis + */ +class Mailer implements MailerInterface +{ + protected $mailer; + protected $router; + protected $templating; + protected $parameters; + + public function __construct($mailer, RouterInterface $router, EngineInterface $templating, array $parameters) + { + $this->mailer = $mailer; + $this->router = $router; + $this->templating = $templating; + $this->parameters = $parameters; + } + + public function sendConfirmationEmailMessage(UserInterface $user) + { + $template = $this->parameters['confirmation.template']; + $url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), true); + $rendered = $this->templating->render($template, array( + 'user' => $user, + 'confirmationUrl' => $url + )); + $this->sendEmailMessage($rendered, $this->parameters['from_email']['confirmation'], $user->getEmail()); + } + + public function sendResettingEmailMessage(UserInterface $user) + { + $template = $this->parameters['resetting.template']; + $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true); + $rendered = $this->templating->render($template, array( + 'user' => $user, + 'confirmationUrl' => $url + )); + $this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail()); + } + + protected function sendEmailMessage($renderedTemplate, $fromEmail, $toEmail) + { + // Render the email, use the first line as the subject, and the rest as the body + $renderedLines = explode("\n", trim($renderedTemplate)); + $subject = $renderedLines[0]; + $body = implode("\n", array_slice($renderedLines, 1)); + + $message = \Swift_Message::newInstance() + ->setSubject($subject) + ->setFrom($fromEmail) + ->setTo($toEmail) + ->setBody($body); + + $this->mailer->send($message); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Mailer/MailerInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Mailer/MailerInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Mailer; + +use FOS\UserBundle\Model\UserInterface; + +/** + * @author Thibault Duplessis + */ +interface MailerInterface +{ + /** + * Send an email to a user to confirm the account creation + * + * @param UserInterface $user + */ + function sendConfirmationEmailMessage(UserInterface $user); + + /** + * Send an email to a user to confirm the password reset + * + * @param UserInterface $user + */ + function sendResettingEmailMessage(UserInterface $user); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Mailer/NoopMailer.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Mailer/NoopMailer.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Mailer; + +use FOS\UserBundle\Model\UserInterface; + +/** + * This mailer does nothing. + * It is used when the 'email' configuration is not set, + * and allows to use this bundle without swiftmailer. + * + * @author Thibault Duplessis + */ +class NoopMailer implements MailerInterface +{ + public function sendConfirmationEmailMessage(UserInterface $user) + { + // nothing happens. + } + + public function sendResettingEmailMessage(UserInterface $user) + { + // nothing happens. + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/Group.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/Group.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +/** + * @author Johannes M. Schmitt + */ +abstract class Group implements GroupInterface +{ + protected $id; + protected $name; + protected $roles; + + public function __construct($name, $roles = array()) + { + $this->name = $name; + $this->roles = $roles; + } + + public function addRole($role) + { + if (!$this->hasRole($role)) { + $this->roles[] = strtoupper($role); + } + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function hasRole($role) + { + return in_array(strtoupper($role), $this->roles, true); + } + + public function getRoles() + { + return $this->roles; + } + + public function removeRole($role) + { + if (false !== $key = array_search(strtoupper($role), $this->roles, true)) { + unset($this->roles[$key]); + $this->roles = array_values($this->roles); + } + } + + public function setName($name) + { + $this->name = $name; + } + + public function setRoles(array $roles) + { + $this->roles = $roles; + } +} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/GroupInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/GroupInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +/** + * @author Johannes M. Schmitt + * @author Christophe Coevoet + */ +interface GroupInterface +{ + function addRole($role); + + function getId(); + + function getName(); + + function hasRole($role); + + function getRoles(); + + function removeRole($role); + + function setName($name); + + function setRoles(array $roles); +} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/GroupManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/GroupManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +/** + * Abstract Group Manager implementation which can be used as base class for your + * concrete manager. + * + * @author Christophe Coevoet + */ +abstract class GroupManager implements GroupManagerInterface +{ + /** + * Returns an empty group instance. + * + * @param string $name + * @return GroupInterface + */ + public function createGroup($name) + { + $class = $this->getClass(); + + return new $class($name); + } + /** + * Finds a group by name. + * + * @param string $name + * @return GroupInterface + */ + public function findGroupByName($name) + { + return $this->findGroupBy(array('name' => $name)); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/GroupManagerInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/GroupManagerInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +/** + * Interface to be implemented by group managers. This adds an additional level + * of abstraction between your application, and the actual repository. + * + * All changes to groups should happen through this interface. + * + * @author Christophe Coevoet + */ +interface GroupManagerInterface +{ + /** + * Returns an empty group instance. + * + * @param string $name + * @return GroupInterface + */ + function createGroup($name); + + /** + * Deletes a group. + * + * @param GroupInterface $group + * @return void + */ + function deleteGroup(GroupInterface $group); + + /** + * Finds one group by the given criteria. + * + * @param array $criteria + * @return GroupInterface + */ + function findGroupBy(array $criteria); + + /** + * Finds a group by name. + * + * @param string $name + * @return GroupInterface + */ + function findGroupByName($name); + + /** + * Returns a collection with all user instances. + * + * @return \Traversable + */ + function findGroups(); + + /** + * Returns the group's fully qualified class name. + * + * @return string + */ + function getClass(); + + /** + * Updates a group. + * + * @param GroupInterface $group + */ + function updateGroup(GroupInterface $group); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/GroupableInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/GroupableInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +/** + * @author Thibault Duplessis + * @author Johannes M. Schmitt + * @author Christophe Coevoet + */ +interface GroupableInterface +{ + /** + * Gets the groups granted to the user. + * + * @return \Doctrine\Common\Collections\Collection + */ + function getGroups(); + + /** + * Gets the name of the groups which includes the user. + * + * @return array + */ + function getGroupNames(); + + /** + * Indicates whether the user belongs to the specified group or not. + * + * @param string $name Name of the group + * @return Boolean + */ + function hasGroup($name); + + /** + * Add a group to the user groups. + * + * @param GroupInterface $group + */ + function addGroup(GroupInterface $group); + + /** + * Remove a group from the user groups. + * + * @param GroupInterface $group + */ + function removeGroup(GroupInterface $group); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/User.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/User.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,806 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +use Symfony\Component\Security\Core\Role\RoleInterface; +use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\ArrayCollection; +use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface; + +/** + * Storage agnostic user object + * + * @author Thibault Duplessis + * @author Johannes M. Schmitt + */ +abstract class User implements UserInterface, GroupableInterface +{ + const ROLE_DEFAULT = 'ROLE_USER'; + const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN'; + + protected $id; + + /** + * @var string + */ + protected $username; + + /** + * @var string + */ + protected $usernameCanonical; + + /** + * @var string + */ + protected $email; + + /** + * @var string + */ + protected $emailCanonical; + + /** + * @var boolean + */ + protected $enabled; + + /** + * The algorithm to use for hashing + * + * @var string + */ + protected $algorithm; + + /** + * The salt to use for hashing + * + * @var string + */ + protected $salt; + + /** + * Encrypted password. Must be persisted. + * + * @var string + */ + protected $password; + + /** + * Plain password. Used for model validation. Must not be persisted. + * + * @var string + */ + protected $plainPassword; + + /** + * @var \DateTime + */ + protected $lastLogin; + + /** + * Random string sent to the user email address in order to verify it + * + * @var string + */ + protected $confirmationToken; + + /** + * @var \DateTime + */ + protected $passwordRequestedAt; + + /** + * @var Collection + */ + protected $groups; + + /** + * @var Boolean + */ + protected $locked; + + /** + * @var Boolean + */ + protected $expired; + + /** + * @var \DateTime + */ + protected $expiresAt; + + /** + * @var array + */ + protected $roles; + + /** + * @var Boolean + */ + protected $credentialsExpired; + + /** + * @var \DateTime + */ + protected $credentialsExpireAt; + + public function __construct() + { + $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36); + $this->generateConfirmationToken(); + $this->enabled = false; + $this->locked = false; + $this->expired = false; + $this->roles = array(); + $this->credentialsExpired = false; + } + + /** + * Adds a role to the user. + * + * @param string $role + */ + public function addRole($role) + { + $role = strtoupper($role); + if ($role === static::ROLE_DEFAULT) { + return; + } + + if (!in_array($role, $this->roles, true)) { + $this->roles[] = $role; + } + } + + /** + * Implementation of SecurityUserInterface. + * + * @param \Symfony\Component\Security\Core\User\UserInterface $user + * @return Boolean + */ + public function equals(SecurityUserInterface $user) + { + if (!$user instanceof User) { + return false; + } + + if ($this->password !== $user->getPassword()) { + return false; + } + if ($this->getSalt() !== $user->getSalt()) { + return false; + } + if ($this->usernameCanonical !== $user->getUsernameCanonical()) { + return false; + } + if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) { + return false; + } + if (!$this->locked !== $user->isAccountNonLocked()) { + return false; + } + if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) { + return false; + } + if ($this->enabled !== $user->isEnabled()) { + return false; + } + + return true; + } + + /** + * Serializes the user. + * + * The serialized data have to contain the fields used by the equals method and the username. + * + * @return string + */ + public function serialize() + { + return serialize(array( + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled, + )); + } + + /** + * Unserializes the user. + * + * @param string $serialized + */ + public function unserialize($serialized) + { + list( + $this->password, + $this->salt, + $this->usernameCanonical, + $this->username, + $this->expired, + $this->locked, + $this->credentialsExpired, + $this->enabled + ) = unserialize($serialized); + } + + /** + * Removes sensitive data from the user. + * + * Implements SecurityUserInterface + */ + public function eraseCredentials() + { + $this->plainPassword = null; + } + + /** + * Returns the user unique id. + * + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Gets the canonical username in search and sort queries. + * + * @return string + */ + public function getUsernameCanonical() + { + return $this->usernameCanonical; + } + + /** + * Implementation of SecurityUserInterface + * + * @return string + */ + public function getSalt() + { + return $this->salt; + } + + /** + * Gets the algorithm used to encode the password. + * + * @return string + */ + public function getAlgorithm() + { + return $this->algorithm; + } + + /** + * Gets email. + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Gets the canonical email in search and sort queries. + * + * @return string + */ + public function getEmailCanonical() + { + return $this->emailCanonical; + } + + /** + * Gets the encrypted password. + * + * Implements SecurityUserInterface + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Gets the plain password. + * + * @return string + */ + public function getPlainPassword() + { + return $this->plainPassword; + } + + /** + * Gets the last login time. + * + * @return \DateTime + */ + public function getLastLogin() + { + return $this->lastLogin; + } + + /** + * Gets the confirmation token. + * + * @return string + */ + public function getConfirmationToken() + { + return $this->confirmationToken; + } + + /** + * Returns the user roles + * + * Implements SecurityUserInterface + * + * @return array The roles + */ + public function getRoles() + { + $roles = $this->roles; + + foreach ($this->getGroups() as $group) { + $roles = array_merge($roles, $group->getRoles()); + } + + // we need to make sure to have at least one role + $roles[] = static::ROLE_DEFAULT; + + return array_unique($roles); + } + + /** + * Never use this to check if this user has access to anything! + * + * Use the SecurityContext, or an implementation of AccessDecisionManager + * instead, e.g. + * + * $securityContext->isGranted('ROLE_USER'); + * + * @param string $role + * @return Boolean + */ + public function hasRole($role) + { + return in_array(strtoupper($role), $this->getRoles(), true); + } + + /** + * Checks whether the user's account has expired. + * + * Implements AdvancedUserInterface + * + * @return Boolean true if the user's account is non expired, false otherwise + */ + public function isAccountNonExpired() + { + if (true === $this->expired) { + return false; + } + + if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + /** + * Checks whether the user is locked. + * + * Implements AdvancedUserInterface + * + * @return Boolean true if the user is not locked, false otherwise + */ + public function isAccountNonLocked() + { + return !$this->locked; + } + + /** + * Checks whether the user's credentials (password) has expired. + * + * Implements AdvancedUserInterface + * + * @return Boolean true if the user's credentials are non expired, false otherwise + */ + public function isCredentialsNonExpired() + { + if (true === $this->credentialsExpired) { + return false; + } + + if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) { + return false; + } + + return true; + } + + public function isCredentialsExpired() + { + return !$this->isCredentialsNonExpired(); + } + + /** + * Checks whether the user is enabled. + * + * Implements AdvancedUserInterface + * + * @return Boolean true if the user is enabled, false otherwise + */ + public function isEnabled() + { + return $this->enabled; + } + + public function isExpired() + { + return !$this->isAccountNonExpired(); + } + + public function isLocked() + { + return $this->locked; + } + + /** + * Tells if the the given user has the super admin role. + * + * @return Boolean + */ + public function isSuperAdmin() + { + return $this->hasRole(static::ROLE_SUPER_ADMIN); + } + + /** + * Tells if the the given user is this user. + * + * Useful when not hydrating all fields. + * + * @param UserInterface $user + * @return Boolean + */ + public function isUser(UserInterface $user = null) + { + return null !== $user && $this->getId() === $user->getId(); + } + + /** + * Removes a role to the user. + * + * @param string $role + */ + public function removeRole($role) + { + if (false !== $key = array_search(strtoupper($role), $this->roles, true)) { + unset($this->roles[$key]); + $this->roles = array_values($this->roles); + } + } + + /** + * Sets the username. + * + * @param string $username + */ + public function setUsername($username) + { + $this->username = $username; + } + + /** + * Sets the canonical username. + * + * @param string $usernameCanonical + */ + public function setUsernameCanonical($usernameCanonical) + { + $this->usernameCanonical = $usernameCanonical; + } + + /** + * Sets the algorithm + * + * @param string $algorithm + */ + public function setAlgorithm($algorithm) + { + $this->algorithm = $algorithm; + } + + public function setCredentialsExpireAt(\DateTime $date) + { + $this->credentialsExpireAt = $date; + } + + public function setCredentialsExpired($boolean) + { + $this->credentialsExpired = $boolean; + } + + /** + * Sets the email. + * + * @param string $email + */ + public function setEmail($email) + { + $this->email = $email; + } + + /** + * Set the canonical email. + * + * @param string $emailCanonical + */ + public function setEmailCanonical($emailCanonical) + { + $this->emailCanonical = $emailCanonical; + } + + /** + * @param Boolean $boolean + */ + public function setEnabled($boolean) + { + $this->enabled = (Boolean) $boolean; + } + + /** + * Sets this user to expired. + * + * @param Boolean $boolean + */ + public function setExpired($boolean) + { + $this->expired = (Boolean) $boolean; + } + + public function setExpiresAt(\DateTime $date) + { + $this->expiresAt = $date; + } + + /** + * Sets the hashed password. + * + * @param string $password + */ + public function setPassword($password) + { + $this->password = $password; + } + + /** + * Sets the super admin status + * + * @param Boolean $boolean + */ + public function setSuperAdmin($boolean) + { + if (true === $boolean) { + $this->addRole(static::ROLE_SUPER_ADMIN); + } else { + $this->removeRole(static::ROLE_SUPER_ADMIN); + } + } + + /** + * Sets the plain password. + * + * @param string $password + */ + public function setPlainPassword($password) + { + $this->plainPassword = $password; + } + + /** + * Sets the last login time + * + * @param \DateTime $time + */ + public function setLastLogin(\DateTime $time) + { + $this->lastLogin = $time; + } + + /** + * Sets the locking status of the user. + * + * @param Boolean $boolean + */ + public function setLocked($boolean) + { + $this->locked = $boolean; + } + + /** + * Sets the confirmation token + * + * @param string $confirmationToken + */ + public function setConfirmationToken($confirmationToken) + { + $this->confirmationToken = $confirmationToken; + } + + /** + * Sets the timestamp that the user requested a password reset. + * + * @param \DateTime $date + */ + public function setPasswordRequestedAt(\DateTime $date) + { + $this->passwordRequestedAt = $date; + } + + /** + * Gets the timestamp that the user requested a password reset. + * + * @return \DateTime + */ + public function getPasswordRequestedAt() + { + return $this->passwordRequestedAt; + } + + /** + * Checks whether the password reset request has expired. + * + * @param integer $ttl Requests older than this many seconds will be considered expired + * @return Boolean true if the user's password request is non expired, false otherwise + */ + public function isPasswordRequestNonExpired($ttl) + { + return $this->passwordRequestedAt instanceof \DateTime && + $this->passwordRequestedAt->getTimestamp() + $ttl > time(); + } + + /** + * Generates the confirmation token if it is not set. + */ + public function generateConfirmationToken() + { + if (null === $this->confirmationToken) { + $this->confirmationToken = $this->generateToken(); + } + } + + /** + * Sets the roles of the user. + * + * This overwrites any previous roles. + * + * @param array $roles + */ + public function setRoles(array $roles) + { + $this->roles = array(); + + foreach ($roles as $role) { + $this->addRole($role); + } + } + + /** + * Gets the groups granted to the user. + * + * @return Collection + */ + public function getGroups() + { + return $this->groups ?: $this->groups = new ArrayCollection(); + } + + /** + * Gets the name of the groups which includes the user. + * + * @return array + */ + public function getGroupNames() + { + $names = array(); + foreach ($this->getGroups() as $group) { + $names[] = $group->getName(); + } + + return $names; + } + + /** + * Indicates whether the user belongs to the specified group or not. + * + * @param string $name Name of the group + * @return Boolean + */ + public function hasGroup($name) + { + return in_array($name, $this->getGroupNames()); + } + + /** + * Add a group to the user groups. + * + * @param GroupInterface $group + */ + public function addGroup(GroupInterface $group) + { + if (!$this->getGroups()->contains($group)) { + $this->getGroups()->add($group); + } + } + + /** + * Remove a group from the user groups. + * + * @param GroupInterface $group + */ + public function removeGroup(GroupInterface $group) + { + if ($this->getGroups()->contains($group)) { + $this->getGroups()->removeElement($group); + } + } + + public function __toString() + { + return (string) $this->getUsername(); + } + + /** + * Generates a token. + * + * @return string + */ + protected function generateToken() + { + $bytes = false; + if (function_exists('openssl_random_pseudo_bytes') && 0 !== stripos(PHP_OS, 'win')) { + $bytes = openssl_random_pseudo_bytes(32, $strong); + + if (true !== $strong) { + $bytes = false; + } + } + + // let's just hope we got a good seed + if (false === $bytes) { + $bytes = hash('sha256', uniqid(mt_rand(), true), true); + } + + return base_convert(bin2hex($bytes), 16, 36); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/UserInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/UserInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,218 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +use Symfony\Component\Security\Core\User\AdvancedUserInterface; + +/** + * @author Thibault Duplessis + * @author Johannes M. Schmitt + */ +interface UserInterface extends AdvancedUserInterface, \Serializable +{ + /** + * Gets the algorithm used to encode the password. + * + * @return string + */ + function getAlgorithm(); + + /** + * Sets the algorithm + * + * @param string $algorithm + */ + function setAlgorithm($algorithm); + + /** + * Sets the username. + * + * @param string $username + */ + function setUsername($username); + + /** + * Gets the canonical username in search and sort queries. + * + * @return string + */ + function getUsernameCanonical(); + + /** + * Sets the canonical username. + * + * @param string $usernameCanonical + */ + function setUsernameCanonical($usernameCanonical); + + /** + * Gets email. + * + * @return string + */ + function getEmail(); + + /** + * Sets the email. + * + * @param string $email + */ + function setEmail($email); + + /** + * Gets the canonical email in search and sort queries. + * + * @return string + */ + function getEmailCanonical(); + + /** + * Set the canonical email. + * + * @param string $emailCanonical + */ + function setEmailCanonical($emailCanonical); + + /** + * Gets the plain password. + * + * @return string + */ + function getPlainPassword(); + + /** + * Sets the plain password. + * + * @param string $password + */ + function setPlainPassword($password); + + /** + * Sets the hashed password. + * + * @param string $password + */ + function setPassword($password); + + /** + * Tells if the the given user has the super admin role. + * + * @return Boolean + */ + function isSuperAdmin(); + + /** + * Tells if the the given user is this user. + * + * Useful when not hydrating all fields. + * + * @param UserInterface $user + * @return Boolean + */ + function isUser(UserInterface $user = null); + + /** + * @param Boolean $boolean + */ + function setEnabled($boolean); + + /** + * Sets the locking status of the user. + * + * @param Boolean $boolean + */ + function setLocked($boolean); + + /** + * Sets the super admin status + * + * @param Boolean $boolean + */ + function setSuperAdmin($boolean); + + /** + * Generates the confirmation token if it is not set. + */ + function generateConfirmationToken(); + + /** + * Gets the confirmation token. + * + * @return string + */ + function getConfirmationToken(); + + /** + * Sets the confirmation token + * + * @param string $confirmationToken + */ + function setConfirmationToken($confirmationToken); + + /** + * Sets the timestamp that the user requested a password reset. + * + * @param \DateTime $date + */ + function setPasswordRequestedAt(\DateTime $date); + + /** + * Checks whether the password reset request has expired. + * + * @param integer $ttl Requests older than this many seconds will be considered expired + * @return Boolean true if the user's password request is non expired, false otherwise + */ + function isPasswordRequestNonExpired($ttl); + + /** + * Sets the last login time + * + * @param \DateTime $time + */ + function setLastLogin(\DateTime $time); + + /** + * Never use this to check if this user has access to anything! + * + * Use the SecurityContext, or an implementation of AccessDecisionManager + * instead, e.g. + * + * $securityContext->isGranted('ROLE_USER'); + * + * @param string $role + * @return Boolean + */ + function hasRole($role); + + /** + * Sets the roles of the user. + * + * This overwrites any previous roles. + * + * @param array $roles + */ + function setRoles(array $roles); + + /** + * Adds a role to the user. + * + * @param string $role + */ + function addRole($role); + + /** + * Removes a role to the user. + * + * @param string $role + */ + function removeRole($role); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/UserManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/UserManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,209 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +use FOS\UserBundle\Util\CanonicalizerInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * Abstract User Manager implementation which can be used as base class for your + * concrete manager. + * + * @author Johannes M. Schmitt + */ +abstract class UserManager implements UserManagerInterface, UserProviderInterface +{ + protected $encoderFactory; + protected $algorithm; + protected $usernameCanonicalizer; + protected $emailCanonicalizer; + + /** + * Constructor. + * + * @param EncoderFactoryInterface $encoderFactory + * @param string $algorithm + * @param CanonicalizerInterface $usernameCanonicalizer + * @param CanonicalizerInterface $emailCanonicalizer + */ + public function __construct(EncoderFactoryInterface $encoderFactory, $algorithm, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer) + { + $this->encoderFactory = $encoderFactory; + $this->algorithm = $algorithm; + $this->usernameCanonicalizer = $usernameCanonicalizer; + $this->emailCanonicalizer = $emailCanonicalizer; + } + + /** + * Returns an empty user instance + * + * @return UserInterface + */ + public function createUser() + { + $class = $this->getClass(); + $user = new $class; + $user->setAlgorithm($this->algorithm); + + return $user; + } + + /** + * Finds a user by email + * + * @param string $email + * @return UserInterface + */ + public function findUserByEmail($email) + { + return $this->findUserBy(array('emailCanonical' => $this->canonicalizeEmail($email))); + } + + /** + * Finds a user by username + * + * @param string $username + * @return UserInterface + */ + public function findUserByUsername($username) + { + return $this->findUserBy(array('usernameCanonical' => $this->canonicalizeUsername($username))); + } + + /** + * Finds a user either by email, or username + * + * @param string $usernameOrEmail + * @return UserInterface + */ + public function findUserByUsernameOrEmail($usernameOrEmail) + { + if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) { + return $this->findUserByEmail($usernameOrEmail); + } + + return $this->findUserByUsername($usernameOrEmail); + } + + /** + * Finds a user either by confirmation token + * + * @param string $token + * @return UserInterface + */ + public function findUserByConfirmationToken($token) + { + return $this->findUserBy(array('confirmationToken' => $token)); + } + + /** + * Refreshed a user by User Instance + * + * Throws UnsupportedUserException if a User Instance is given which is not + * managed by this UserManager (so another Manager could try managing it) + * + * It is strongly discouraged to use this method manually as it bypasses + * all ACL checks. + * + * @param SecurityUserInterface $user + * @return UserInterface + */ + public function refreshUser(SecurityUserInterface $user) + { + if (!$user instanceof $this->class) { + throw new UnsupportedUserException('Account is not supported.'); + } + + return $this->loadUserByUsername($user->getUsername()); + } + + /** + * Loads a user by username + * + * It is strongly discouraged to call this method manually as it bypasses + * all ACL checks. + * + * @param string $username + * @return UserInterface + */ + public function loadUserByUsername($username) + { + $user = $this->findUserByUsername($username); + + if (!$user) { + throw new UsernameNotFoundException(sprintf('No user with name "%s" was found.', $username)); + } + + return $user; + } + + /** + * {@inheritDoc} + */ + public function updateCanonicalFields(UserInterface $user) + { + $user->setUsernameCanonical($this->canonicalizeUsername($user->getUsername())); + $user->setEmailCanonical($this->canonicalizeEmail($user->getEmail())); + } + + /** + * {@inheritDoc} + */ + public function updatePassword(UserInterface $user) + { + if (0 !== strlen($password = $user->getPlainPassword())) { + $user->setAlgorithm($this->algorithm); + $encoder = $this->getEncoder($user); + $user->setPassword($encoder->encodePassword($password, $user->getSalt())); + $user->eraseCredentials(); + } + } + + /** + * Canonicalizes an email + * + * @param string $email + * @return string + */ + protected function canonicalizeEmail($email) + { + return $this->emailCanonicalizer->canonicalize($email); + } + + /** + * Canonicalizes a username + * + * @param string $username + * @return string + */ + protected function canonicalizeUsername($username) + { + return $this->usernameCanonicalizer->canonicalize($username); + } + + protected function getEncoder(UserInterface $user) + { + return $this->encoderFactory->getEncoder($user); + } + + /** + * {@inheritDoc} + */ + public function supportsClass($class) + { + return $class === $this->getClass(); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Model/UserManagerInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Model/UserManagerInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Model; + +use Symfony\Component\Validator\Constraint; + +/** + * Interface to be implemented by user managers. This adds an additional level + * of abstraction between your application, and the actual repository. + * + * All changes to users should happen through this interface. + * + * The class also contains ACL annotations which will only work if you have the + * SecurityExtraBundle installed, otherwise they will simply be ignored. + * + * @author Gordon Franke + * @author Thibault Duplessis + * @author Johannes M. Schmitt + */ +interface UserManagerInterface +{ + /** + * Creates an empty user instance. + * + * @return UserInterface + */ + function createUser(); + + /** + * Deletes a user. + * + * @param UserInterface $user + */ + function deleteUser(UserInterface $user); + + /** + * Finds one user by the given criteria. + * + * @param array $criteria + * @return UserInterface + */ + function findUserBy(array $criteria); + + /** + * Find a user by its username. + * + * @param string $username + * @return UserInterface or null if user does not exist + */ + function findUserByUsername($username); + + /** + * Finds a user by its email. + * + * @param string $email + * @return UserInterface or null if user does not exist + */ + function findUserByEmail($email); + + /** + * Finds a user by its username or email. + * + * @param string $usernameOrEmail + * @return UserInterface or null if user does not exist + */ + function findUserByUsernameOrEmail($usernameOrEmail); + + /** + * Finds a user by its confirmationToken. + * + * @param string $token + * @return UserInterface or null if user does not exist + */ + function findUserByConfirmationToken($token); + + /** + * Returns a collection with all user instances. + * + * @return \Traversable + */ + function findUsers(); + + /** + * Returns the user's fully qualified class name. + * + * @return string + */ + function getClass(); + + /** + * Reloads a user. + * + * @param UserInterface $user + */ + function reloadUser(UserInterface $user); + + /** + * Updates a user. + * + * @param UserInterface $user + */ + function updateUser(UserInterface $user); + + /** + * Updates the canonical username and email fields for a user. + * + * @param UserInterface $user + */ + function updateCanonicalFields(UserInterface $user); + + /** + * Updates a user password if a plain password is set. + * + * @param UserInterface $user + */ + function updatePassword(UserInterface $user); + + /** + * Checks the uniqueness of the given fields, returns true if its unique. + * + * @param UserInterface $value + * @param Constraint $constraint + * @return Boolean + */ + function validateUnique(UserInterface $value, Constraint $constraint); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/README.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/README.markdown Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,52 @@ +FOSUserBundle +============= + +The FOSUserBundle adds support for a database-backed user system in Symfony2. +It provides a flexible framework for user management that aims to handle +common tasks such as user login, registration and password retrieval. + +Features include: + +- Users can be stored via Doctrine ORM, MongoDB or CouchDB ODM +- REST-ful authentication +- Registration support, with an optional confirmation per mail +- Password reset support +- Unit tested + +**Caution:** This bundles is developed in sync with [symfony's repository](https://github.com/symfony/symfony) + +Documentation +------------- + +The bulk of the documentation is stored in the `Resources/doc/index.md` +file in this bundle: + +[Read the Documentation](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md) + +Installation +------------ + +All the installation instructions are located in [documentation](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md). + +License +------- + +This bundle is under the MIT license. See the complete license in the bundle: + + Resources/meta/LICENSE + +About +----- + +UserBundle is a [knplabs](https://github.com/knplabs) initiative. +See also the list of [contributors](https://github.com/FriendsOfSymfony/FOSUserBundle/contributors). + +Reporting an issue or a feature request +--------------------------------------- + +Issues and feature requests are tracked in the [Github issue tracker](https://github.com/FriendsOfSymfony/FOSUserBundle/issues). + +When reporting a bug, it may be a good idea to reproduce it in a basic project +built using the [Symfony Standard Edition](https://github.com/symfony/symfony-standard) +to allow developers of the bundle to reproduce the issue by simply cloning it +and following some steps. \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/change_password.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/change_password.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,30 @@ + + + + + + + + %fos_user.change_password.form.type% + %fos_user.change_password.form.name% + + + %fos_user.change_password.form.validation_groups% + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/couchdb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/couchdb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,30 @@ + + + + + + FOS\UserBundle\CouchDocument\UserManager + + + + + + %fos_user.encoder.algorithm% + + + + %fos_user.model.user.class% + + + + %fos_user.model_manager_name% + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/couchdb_group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/couchdb_group.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + + + + + FOS\UserBundle\CouchDocument\GroupManager + + + + + + %fos_user.model.group.class% + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.couchdb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.couchdb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.mongodb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.mongodb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.orm.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/Group.orm.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.couchdb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.couchdb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.mongodb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.mongodb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.orm.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/doctrine/User.orm.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/group.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,31 @@ + + + + + + + + %fos_user.group.form.type% + %fos_user.group.form.name% + + + %fos_user.group.form.validation_groups% + + + + + + %fos_user.model.group.class% + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/mailer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/mailer.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,30 @@ + + + + + + FOSUserBundle:Resetting:email.txt.twig + FOSUserBundle:Registration:email.txt.twig + + + + + + + + + %fos_user.registration.confirmation.template% + %fos_user.resetting.email.template% + + %fos_user.registration.confirmation.from_email% + %fos_user.resetting.email.from_email% + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/mongodb.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/mongodb.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,22 @@ + + + + + + + + %fos_user.encoder.algorithm% + + + + %fos_user.model.user.class% + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/mongodb_group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/mongodb_group.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + + + + + FOS\UserBundle\Document\GroupManager + + + + + + %fos_user.model.group.class% + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/orm.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/orm.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,26 @@ + + + + + + + + %fos_user.encoder.algorithm% + + + + %fos_user.model.user.class% + + + + %fos_user.model_manager_name% + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/orm_group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/orm_group.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ + + + + + + FOS\UserBundle\Entity\GroupManager + + + + + + %fos_user.model.group.class% + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/profile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/profile.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,31 @@ + + + + + + + + %fos_user.profile.form.type% + %fos_user.profile.form.name% + + + %fos_user.profile.form.validation_groups% + + + + + %fos_user.model.user.class% + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/registration.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,32 @@ + + + + + + + + %fos_user.registration.form.type% + %fos_user.registration.form.name% + + + %fos_user.registration.form.validation_groups% + + + + + + %fos_user.model.user.class% + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/resetting.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/resetting.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,30 @@ + + + + + + + + %fos_user.resetting.form.type% + %fos_user.resetting.form.name% + + + %fos_user.resetting.form.validation_groups% + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/change_password.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/change_password.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,12 @@ + + + + + + FOSUserBundle:ChangePassword:changePassword + GET|POST + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/group.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/group.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,30 @@ + + + + + + FOSUserBundle:Group:list + GET + + + + FOSUserBundle:Group:new + + + + FOSUserBundle:Group:show + GET + + + + FOSUserBundle:Group:edit + + + + FOSUserBundle:Group:delete + GET + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/profile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/profile.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,16 @@ + + + + + + FOSUserBundle:Profile:show + GET + + + + FOSUserBundle:Profile:edit + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/registration.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,26 @@ + + + + + + FOSUserBundle:Registration:register + + + + FOSUserBundle:Registration:checkEmail + GET + + + + FOSUserBundle:Registration:confirm + GET + + + + FOSUserBundle:Registration:confirmed + GET + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/resetting.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/resetting.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,27 @@ + + + + + + FOSUserBundle:Resetting:request + GET + + + + FOSUserBundle:Resetting:sendEmail + POST + + + + FOSUserBundle:Resetting:checkEmail + GET + + + + FOSUserBundle:Resetting:reset + GET|POST + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/routing/security.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/routing/security.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,19 @@ + + + + + + FOSUserBundle:Security:login + + + + FOSUserBundle:Security:check + + + + FOSUserBundle:Security:logout + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/security.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/security.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,26 @@ + + + + + + FOS\UserBundle\Security\Encoder\EncoderFactory + FOS\UserBundle\Security\InteractiveLoginListener + + + + + %security.encoder.digest.class% + %fos_user.encoder.encode_as_base64% + %fos_user.encoder.iterations% + + + + + + + \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/username_form_type.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/username_form_type.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/util.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/util.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/validation.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/validation.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/config/validator.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/config/validator.xml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,28 @@ + + + + + + FOS\UserBundle\Validator\PasswordValidator + FOS\UserBundle\Validator\UniqueValidator + + + + + + + + + + + + + + + + + + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/command_line_tools.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/command_line_tools.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,145 @@ +FOSUserBundle Command Line Tools +================================ + +The FOSUserBundle provides a number of command line utilities to help manage your +application's users. Commands are available for the following tasks: + +1. Creating a User +2. Activating a User +3. Deactivating a User +4. Promoting a User +5. Demoting a User +6. Change a User's Password + +**Note:** + +``` +You must have correctly installed and configured the FOSUserBundle before using +these commands. +``` + +### Create a User + +You can use the `fos:user:create` command to create a new user for your application. +The command takes three arguments, the `username`, `email`, and `password` for +the user you are creating. + +For example if you wanted to create a user with username `testuser`, with email +`test@example.com` and password `p@ssword`, you would run the command as follows. + +``` bash +$ php app/console fos:user:create testuser test@example.com p@ssword +``` + +If any of the required arguments are not passed to the command, an interactive prompt +will ask you to enter them. For example, if you ran the command as follows, then +you would be prompted to enter the `email` and `password` for the user +you want to create. + +``` bash +$ php app/console fos:user:create testuser +``` + +There are two options that you can pass to the command as well. They are +`--super-admin` and `--inactive`. + +Specifying the `--super-admin` option will flag the user as a super admin when +the user is created. A super admin has access to any part of your application. +An example is provided below: + +``` bash +$ php app/console fos:user:create adminuser --super-admin +``` + +If you specify the `--inactive` option, then the user that you create will no be +able to login until he is activated. + +``` bash +$ php app/console fos:user:create testuser --inactive +``` + +### Activate a User + +The `fos:user:activate` command activates an inactive user. The only argument +that the command requires is the `username` of the user who should be activated. +If no `username` is specified then an interactive prompt will ask you +to enter one. An example of using this command is listed below. + +``` bash +$ php app/console fos:user:activate testuser +``` + +### Deactivate a User + +The `fos:user:deactivate` command deactivates a user. Just like the activate +command, the only required argument is the `username` of the user who should be +activated. If no `username` is specified then an interactive prompt will ask you +to enter one. Below is an example of using this command. + +``` bash +$ php app/console fos:user:deactivate testuser +``` + +### Promote a User + +The `fos:user:promote` command enables you to add a role to a user or make the +user a super administrator. + +If you would like to add a role to a user you simply pass the `username` of the +user as the first argument to the command and the `role` to add to the user as +the second. + +``` bash +$ php app/console fos:user:promote testuser ROLE_ADMIN +``` + +You can promote a user to a super administrator by passing the `--super` option +after specifying the `username`. + +``` bash +$ php app/console fos:user:promote testuser --super +``` + +If any of the arguments to the command are not specified then an interactive +prompt will ask you to enter them. + +**Note:** You may not specify the `role` argument and the `--super` option simultaneously. + +### Demote a User + +The `fos:user:demote` command is similar to the promote command except that +instead of adding a role to the user it removes it. You can also revoke a user's +super administrator status with this command. + +If you would like to remove a role from a user you simply pass the `username` of +the user as the first argument to the command and the `role` to remove as the +second. + +``` bash +$ php app/console fos:user:demote testuser ROLE_ADMIN +``` + +To revoke the super administrator status of a user, simply pass the `username` as +an argument to the command as well as the `--super` option. + +``` bash +$ php app/console fos:user:demote testuser --super +``` + +If any of the arguments to the command are not specified then an interactive +prompt will ask you to enter them. + +**Note:** You may not specify the `role` argument and the `--super` option simultaneously. + +### Change a User's Password + +The `fos:user:change-password` command provides an easy way to change a user's +password. The command takes two arguments, the `username` of the user whose +password you would like to change and the new `password`. + +``` bash +$ php app/console fos:user:change-password testuser newp@ssword +``` + +If you do not specify the `password` argument then an interactive prompt will +ask you to enter one. diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/configuration_reference.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/configuration_reference.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,74 @@ +FOSUserBundle Configuration Reference +===================================== + +All available configuration options are listed below with their default values. + +``` yaml +# app/config/config.yml +fos_user: + db_driver: ~ # Required + firewall_name: ~ # Required + user_class: ~ # Required + use_listener: true + use_username_form_type: true + model_manager_name: null # change it to the name of your entity/document manager if you don't want to use the default one. + from_email: + address: webmaster@example.com + sender_name: Admin + profile: + form: + type: fos_user_profile + handler: fos_user.profile.form.handler.default + name: fos_user_profile_form + validation_groups: [Profile] + change_password: + form: + type: fos_user_change_password + handler: fos_user.change_password.form.handler.default + name: fos_user_change_password_form + validation_groups: [ChangePassword] + registration: + confirmation: + from_email: # Use this node only if you don't want the global email address for the confirmation email + address: ... + sender_name: ... + enabled: false # change to true for required email confirmation + template: FOSUserBundle:Registration:email.txt.twig + form: + type: fos_user_registration + handler: fos_user.registration.form.handler.default + name: fos_user_registration_form + validation_groups: [Registration] + resetting: + token_ttl: 86400 + email: + from_email: # Use this node only if you don't want the global email address for the resetting email + address: ... + sender_name: ... + template: FOSUserBundle:Resetting:email.txt.twig + form: + type: fos_user_resetting + handler: fos_user.resetting.form.handler.default + name: fos_user_resetting_form + validation_groups: [ResetPassword] + service: + mailer: fos_user.mailer.default + email_canonicalizer: fos_user.util.email_canonicalizer.default + username_canonicalizer: fos_user.util.username_canonicalizer.default + user_manager: fos_user.user_manager.default + encoder: + algorithm: sha512 + encode_as_base64: false + iterations: 1 + template: + engine: twig + theme: FOSUserBundle::form.html.twig + group: + group_class: ~ # Required when using groups + group_manager: fos_user.group_manager.default + form: + type: fos_user_group + handler: fos_user.group.form.handler.default + name: fos_user_group_form + validation_groups: [Registration] +``` diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/index.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/index.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,429 @@ +Getting Started With FOSUserBundle +================================== + +The Symfony2 security component provides a flexible security framework that +allows you to load users from configuration, a database, or anywhere else +you can imagine. The FOSUserBundle builds on top of this to make it quick +and easy to store users in a database. + +So, if you need to persist and fetch the users in your system to and from +a database, then you're in the right place. + +## Prerequisites + +### Translations + +If you wish to use default texts provided in this bundle, you have to make +sure you have translator enabled in your config. + +``` +# app/config/config.yml + +framework: + translator: ~ +``` + +For more information about translations, check [Symfony documentation](http://symfony.com/doc/2.0/book/translation.html). + +## Installation + +Installation is a quick (I promise!) 8 step process: + +1. Download FOSUserBundle +2. Configure the Autoloader +3. Enable the Bundle +4. Create your User class +5. Configure your application's security.yml +6. Configure the FOSUserBundle +7. Import FOSUserBundle routing +8. Update your database schema + +### Step 1: Download FOSUserBundle + +Ultimately, the FOSUserBundle files should be downloaded to the +`vendor/bundles/FOS/UserBundle` directory. + +This can be done in several ways, depending on your preference. The first +method is the standard Symfony2 method. + +**Using the vendors script** + +Add the following lines in your `deps` file: + +``` +[FOSUserBundle] + git=git://github.com/FriendsOfSymfony/FOSUserBundle.git + target=bundles/FOS/UserBundle +``` + +Now, run the vendors script to download the bundle: + +``` bash +$ php bin/vendors install +``` + +**Using submodules** + +If you prefer instead to use git submodules, the run the following: + +``` bash +$ git submodule add git://github.com/FriendsOfSymfony/FOSUserBundle.git vendor/bundles/FOS/UserBundle +$ git submodule update --init +``` + +### Step 2: Configure the Autoloader + +Add the `FOS` namespace to your autoloader: + +``` php +registerNamespaces(array( + // ... + 'FOS' => __DIR__.'/../vendor/bundles', +)); +``` + +### Step 3: Enable the bundle + +Finally, enable the bundle in the kernel: + +``` php + If you override the __construct() method in your User class, be sure +> to call parent::__construct(), as the base User class depends on +> this to initialize some fields. + +**a) Doctrine ORM User class** + +If you're persisting your users via the Doctrine ORM, then your `User` class +should live in the `Entity` namespace of your bundle and look like this to +start: + +``` php + `User` is a reserved keyword in SQL so you cannot use it as table name. + +**b) MongoDB User class** + +If you're persisting your users via the Doctrine MongoDB ODM, then your `User` +class should live in the `Document` namespace of your bundle and look like +this to start: + +``` php + Although we have used the form login mechanism in this example, the FOSUserBundle +> user provider is compatible with many other authentication methods as well. Please +> read the Symfony2 Security component documention for more information on the +> other types of authentication methods. + +The `access_control` section is where you specify the credentials necessary for +users trying to access specific parts of your application. The bundle requires +that the login form and all the routes used to create a user and reset the password +be available to unauthenticated users but use the same firewall as +the pages you want to secure with the bundle. This is why you have specified that +the any request matching the `/login` pattern or starting with `/register` or +`/resetting` have been made available to anonymous users. You have also specified +that any request beginning with `/admin` will require a user to have the +`ROLE_ADMIN` role. + +For more information on configuring the `security.yml` file please read the Symfony2 +security component [documentation](http://symfony.com/doc/current/book/security.html). + +**Note:** + +> Pay close attention to the name, `main`, that we have given to the firewall which +> the FOSUserBundle is configured in. You will use this in the next step when you +> configure the FOSUserBundle. + +### Step 6: Configure the FOSUserBundle + +Now that you have properly configured your application's `security.yml` to work +with the FOSUserBundle, the next step is to configure the bundle to work with +the specific needs of your application. + +Add the following configuration to your `config.yml` file according to which type +of datastore you are using. + +``` yaml +# app/config/config.yml +fos_user: + db_driver: orm # other valid values are 'mongodb', 'couchdb' + firewall_name: main + user_class: Acme\UserBundle\Entity\User +``` + +Or if you prefer XML: + +``` xml +# app/config/config.xml + + + + +``` + +Only three configuration values are required to use the bundle: + +* The type of datastore you are using (`orm`, `mongodb`, or `couchdb`). +* The firewall name which you configured in Step 5. +* The fully qualified class name (FQCN) of the `User` class which you created in Step 2 + +### Step 7: Import FOSUserBundle routing files + +Now that you have activated and configured the bundle, all that is left to do is +import the FOSUserBundle routing files. + +By importing the routing files you will have ready made pages for things such as +logging in, creating users, etc. + +In YAML: + +``` yaml +# app/config/routing.yml +fos_user_security: + resource: "@FOSUserBundle/Resources/config/routing/security.xml" + +fos_user_profile: + resource: "@FOSUserBundle/Resources/config/routing/profile.xml" + prefix: /profile + +fos_user_register: + resource: "@FOSUserBundle/Resources/config/routing/registration.xml" + prefix: /register + +fos_user_resetting: + resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" + prefix: /resetting + +fos_user_change_password: + resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" + prefix: /change-password +``` + +Or if you prefer XML: + +``` xml + + + + + + +``` + +**Note:** + +> In order to use the built-in email functionality (confirmation of the account, +> resetting of the password), you must activate and configure the SwiftmailerBundle. + +### Step 8: Update your database schema + +Now that the bundle is configured, the last thing you need to do is update your +database schema because you have added a new entity, the `User` class which you +created in Step 2. + +For ORM run the following command. + +``` bash +$ php app/console doctrine:schema:update --force +``` + +For MongoDB users you can run the following command to create the indexes. + +``` bash +$ php app/console doctrine:mongodb:schema:create --index +``` + +You now can login at `http://app.com/app_dev.php/login`! + +### Next Steps + +Now that you have completed the basic installation and configuration of the +FOSUserBundle, you are ready to learn about more advanced features and usages +of the bundle. + +The following documents are available: + +1. [Overriding Templates](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md) +2. [Overriding Controllers](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_controllers.md) +3. [Overriding Forms](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md) +4. [Command Line Tools](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/command_line_tools.md) +5. [Supplemental Documenation](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/supplemental.md) +6. [Configuration Reference](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/configuration_reference.md) diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/overriding_controllers.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/overriding_controllers.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,102 @@ +Overriding Default FOSUserBundle Controllers +============================================ + +The default controllers packaged with the FOSUserBundle provide a lot of +functionality that is sufficient for general use cases. But, you might find +that you need to extend that functionality and add some logic that suits the +specific needs of your application. + +The first step to overriding a controller in the bundle is to create a child +bundle whose parent is FOSUserBundle. The following code snippet creates a new +bundle named `AcmeUserBundle` that declares itself a child of FOSUserBundle. + +``` php +// src/Acme/UserBundle/AcmeUserBundle.php +container->get('fos_user.registration.form'); + $formHandler = $this->container->get('fos_user.registration.form.handler'); + $confirmationEnabled = $this->container->getParameter('fos_user.registration.confirmation.enabled'); + + $process = $formHandler->process($confirmationEnabled); + if ($process) { + $user = $form->getData(); + + /***************************************************** + * Add new functionality (e.g. log the registration) * + *****************************************************/ + $this->get('logger')->info( + sprintf('New user registration: %s', $user) + ); + + if ($confirmationEnabled) { + $this->container->get('session')->set('fos_user_send_confirmation_email/email', $user->getEmail()); + $route = 'fos_user_registration_check_email'; + } else { + $this->authenticateUser($user); + $route = 'fos_user_registration_confirmed'; + } + + $this->setFlash('fos_user_success', 'registration.flash.user_created'); + $url = $this->container->get('router')->generate($route); + + return new RedirectResponse($url); + } + + return $this->container->get('templating')->renderResponse('FOSUserBundle:Registration:register.html.'.$this->getEngine(), array( + 'form' => $form->createView(), + 'theme' => $this->container->getParameter('fos_user.template.theme'), + )); + } +} +``` + +**Note:** + +``` +If you do not extend the FOSUserBundle controller class that you want to override +and instead extend ContainerAware or the Controller class provided by the FrameworkBundle +then you must implement all of the methods of the FOSUserBundle controller that +you are overriding. +``` diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/overriding_forms.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/overriding_forms.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,305 @@ +Overriding Default FOSUserBundle Forms +====================================== + +## Overriding a Form Type + +The default forms packaged with the FOSUserBundle provide functionality for +registering new user, updating your profile, changing your password and +much more. These forms work well with the bundle's default classes and controllers. +But, as you start to add more properties to your `User` +class or you decide you want to add a few options to the registration form you +will find that you need to override the forms in the bundle. + +Suppose that you have created an ORM user class with the following class name, +`Acme\UserBundle\Entity\User`. In this class, you have added a `name` property +because you would like to save the user's name as well as their username and +email address. Now, when a user registers for your site they should enter in their +name as well as their username, email and password. Below is an example `$name` +property and its validators. + +``` php +// src/Acme/UserBundle/Entity/User.php +add('name'); + } + + public function getName() + { + return 'acme_user_registration'; + } +} +``` + +Now that you have created your custom form type, you must declare it as a service +and add a tag to it. The tag must have a `name` value of `form.type` and an `alias` +value that is the equal to the string returned from the `getName` method of your +form type class. The `alias` that you specify is what you will use in the FOSUserBundle +configuration to let the bundle know that you want to use your custom form. + +Below is an example of configuring your form type as a service in XML: + +``` xml + + + + + + + + + + %fos_user.model.user.class% + + + + + +``` + +Or if you prefer YAML: + +``` yaml +# src/Acme/UserBundle/Resources/config/services.yml +services: + acme_user.registration.form.type: + class: Acme\UserBundle\Form\Type\RegistrationFormType + arguments: [%fos_user.model.user.class%] + tags: + - { name: form.type, alias: acme_user_registration } +``` + +**Note:** + +``` +In the form type service configuration you have specified the `fos_user.model.user.class` +container parameter as a constructor argument. Unless you have redefined the +constructor in your form type class, you must include this argument as it is a +requirement of the FOSUserBundle form type that you extended. +``` + +Finally, you must update the configuration of the FOSUserBundle so that it will +use your form type instead of the default one. Below is the configuration for +changing the registration form type in YAML. + +``` yaml +# app/config/config.yml +fos_user: + # ... + registration: + form: + type: acme_user_registration +``` + +Note how the `alias` value used in your form type's service configuration tag +is used in the bundle configuration to tell the FOSUserBundle to use your custom +form type. + +## Overriding Form Handlers + +There are two ways to override the default functionality provided by the +FOSUserBundle form handlers. The easiest way is to override the `onSuccess` +method of the handler. The `onSuccess` method is called after the form has been +bound and validated. + +The second way is to override the `process` method. Overriding +the `process` method should only be necessary when more advanced functionality +is necessary when binding and validating the form. + +Suppose you want to add some functionality that takes place after a successful +user registration. First you need to create a new class that extends +`FOS\UserBundle\Form\Handler\RegistrationFormHandler` and then override the +protected `onSuccess` method. + +``` php +// src/Acme/UserBundle/Form/Handler/RegistrationFormHandler.php +userManager->createUser(); + $this->form->setData($user); + + if ('POST' == $this->request->getMethod()) { + $this->form->bindRequest($this->request); + if ($this->form->isValid()) { + + // do your custom logic here + + return true; + } + } + + return false; + } +} +``` + +**Note:** + +``` +The process method should return true for a successful submission and false +otherwise. +``` + +Now that you have created and implemented your custom form handler class, you +must configure it as a service in the container. Below is an example of +configuring your form handler as a service in XML: + +``` xml + + + + + + + + + + + + + + + + + +``` + +Or if you prefer YAML: + +``` yaml +# src/Acme/UserBundle/Resources/config/services.yml +services: + acme_user.form.handler.registration: + class: Acme\UserBundle\Form\Handler\RegistrationFormHandler + arguments: ["@fos_user.registration.form", "@request", "@fos_user.user_manager", "@fos_user.mailer"] + scope: request + public: false +``` + +Here you have injected other services as arguments to the constructor of our class +because these arguments are required by the base FOSUserBundle form handler class +which you extended. + +Now that your new form handler has been configured in the container, all that is +left to do is update the FOSUserBundle configuration. + +``` yaml +# app/config/config.yml +fos_user: + # ... + registration: + form: + handler: acme_user.form.handler.registration +``` + +Note how the `id` of your configured service is used in the bundle configuration +to tell the FOSUserBundle to use your custom form handler. + +At this point, when a user registers on your site your service will be used to +handle the form submission. diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/doc/overriding_templates.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/doc/overriding_templates.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,154 @@ +Overriding Default FOSUserBundle Templates +========================================== + +As you start to incorporate FOSUserBundle into your application, you will probably +find that you need to override the default templates that are provided by +the bundle. Although the template names are not configurable, the Symfony2 +framework provides two ways to override the templates of a bundle. + +1. Define a new template of the same name in the `app/Resources` directory +2. Create a new bundle that is defined as a child of `FOSUserBundle` + +### Example: Overriding The Default layout.html.twig + +It is highly recommended that you override the `Resources/views/layout.html.twig` +template so that the pages provided by the FOSUserBundle have a similar look and +feel to the rest of your application. An example of overriding this layout template +is demonstrated below using both of the overriding options listed above. + +Here is the default `layout.html.twig` provided by the FOSUserBundle: + +``` twig + + + + + + +
+ {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %} + {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} | + + {{ 'layout.logout'|trans({}, 'FOSUserBundle') }} + + {% else %} + {{ 'layout.login'|trans({}, 'FOSUserBundle') }} + {% endif %} +
+ + {% for key, message in app.session.getFlashes() %} +
+ {{ message|trans({}, 'FOSUserBundle') }} +
+ {% endfor %} + +
+ {% block fos_user_content %} + {% endblock fos_user_content %} +
+ + +``` + +As you can see its pretty basic and doesn't really have much structure, so you will +want to replace it with a layout file that is appropriate for your application. The +main thing to note in this template is the block named `fos_user_content`. This is +the block where the content from each of the different bundle's actions will be +displayed, so you must make sure to include this block in the layout file you will +use to override the default one. + +The following Twig template file is an example of a layout file that might be used +to override the one provided by the bundle. + +``` twig +{% extends 'AcmeDemoBundle::layout.html.twig' %} + +{% block title %}Acme Demo Application{% endblock %} + +{% block content %} + {% block fos_user_content %}{% endblock %} +{% endblock %} +``` + +This example extends the layout template from a fictional application bundle named +`AcmeDemoBundle`. The `content` block is where the main content of each page is rendered. +This is why the `fos_user_content` block has been placed inside of it. This will +lead to the desired effect of having the output from the FOSUserBundle actions +integrated into our applications layout, preserving the look and feel of the +application. + +**a) Define New Template In app/Resources** + +The easiest way to override a bundle's template is to simply place a new one in +your `app/Resources` folder. To override the layout template located at +`Resources/views/layout.html.twig` in the `FOSUserBundle` directory, you would place +you new layout template at `app/Resources/FOSUserBundle/views/layout.html.twig`. + +As you can see the the pattern for overriding templates in this way is to +create a folder with the name of the bundle class in the `app/Resources` directory. +Then add your new template to this folder, preserving the directory structure from the +original bundle. + +**b) Create A Child Bundle And Override Template** + +**Note:** + +``` +This method is more complicated than the one outlined above. Unless you are +planning to override the controllers as well as the templates, it is recommended +that you use the other method. +``` + +As listed above, you can also create a bundle defined as child of FOSUserBundle +and place the new template in the same location that is resides in the FOSUserBundle. +The first thing you want to do is override the `getParent` method to your bundle +class. + +``` php +// src/Acme/UserBundle/AcmeUserBundle.php + + +
+``` +### The Group class + +The simpliest way to create a Group class is to extend the mapped superclass +provided by the bundle. + +**a) ORM Group class implementation** + +``` php +// src/MyProject/MyBundle/Entity/Group.php +get('fos_user.user_manager'); +``` + +That's the way FOSUserBundle's internal controllers are built. + +## Create a new User + +A new instance of your User class can be created by the user manager. + +``` php +$user = $userManager->createUser(); +``` + +`$user` is now an Entity or a Document, depending on the configuration. + +### Updating a User object + +When creating or updating a User object you need to update the encoded password +and the canonical fields. To make it easier, the bundle comes with a Doctrine +listener handling this for you behind the scenes. + +If you don't want to use the Doctrine listener, you can disable it. In this case +you will have to call the `updateUser` method of the user manager each time +you make a change to your entity. + +In YAML: + +``` yaml +# app/config/config.yml +fos_user: + # ... + user_class: MyProject\MyBundle\Entity\User +``` + +Or if you prefer XML: + +``` xml +# app/config/config.xml + +``` + +The default behavior is to flush the changes when calling the `updateUser` method. +You can disable the flush when using the ORM and the MongoDB implementations by +passing a second argument set to `false`. + +An ORM example: + +``` php +public function MainController extends Controller +{ + public function updateAction($id) + { + $user = // get a user from the datastore + + $user->setEmail($newEmail); + + $this->get('fos_user.user_manager')->updateUser($user, false); + + // make more modifications to the database + + $this->getDoctrine()->getEntityManager()->flush(); + } +} +``` + +Overriding Default User Manager +=============================== + +You can replace the default implementation of the user manager by defining +a service implementing `FOS\UserBundle\Model\UserManagerInterface` and +setting its id in the configuration. + +In YAML: + +``` yaml +fos_user: + # ... + service: + user_manager: custom_user_manager_id +``` + +Overriding Default FOSUserBundle Validation +=========================================== + +The `Resources/config/validation.xml` file contains definitions for custom +validator rules for various classes. The rules defined by FOSUserBundle are +all in validation groups so you can choose not to use them. + +Form Types +========== + +## The username Form Type + +The bundle also provides a convenient username form type. +It appears as a text input, accepts usernames and convert them to a User instance. + +You can enable this feature from the configuration. + +In YAML: + +``` yaml +# app/config/config.yml +fos_user: + use_username_form_type: true +``` + +And then use it in your forms. + +``` php +class MessageFormType extends AbstractType +{ + public function buildForm(FormBuilder $builder, array $options) + { + $builder->add('recipient', 'fos_user_username'); + } +``` + +FOSUserBundle Emails +==================== + +The default mailer relies on Swiftmailer to send the mails of the bundle. +If you want to use another mailer in your project you can change it by defining +your own service implementing `FOS\UserBundle\Mailer\MailerInterface` and +setting its id in the configuration. + +In YAML: + +``` yaml +fos_user: + # ... + service: + mailer: custom_mailer_id +``` + +This bundle comes with two mailer implementations. + +- `fos_user.mailer.default` is the default implementation, and uses Swiftmailer to send emails. +- `fos_user.mailer.noop` does nothing and can be used if your project does not depend on Swiftmailer. + +FOSUserBundle Canonicalization +============================== + +`Canonicalizer` services are used to canonicalize the username and the email +fields for database storage. By default, username and email fields are +canonicalized in the same manner using `mb_convert_case()`. You may configure +your own class for each field provided it implements +`FOS\UserBundle\Util\CanonicalizerInterface`. + +**Note:** + +``` +If you do not have the mbstring extension installed you will need to define your +own `canonicalizer`. +``` \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/meta/LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/meta/LICENSE Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,19 @@ +Copyright (c) 2010-2011 FriendsOfSymfony + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ca.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ca.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Actualitza el grup +group.show.name: Nom del grup +group.new.submit: Crea el grup +group.flash.updated: S'ha actualitzat el grup +group.flash.created: S'ha creat el grup +group.flash.deleted: S'ha eliminat el grup + +# Security +security.login.username: "Nom d'usuari:" +security.login.password: "Contrasenya:" +security.login.remember_me: Recorda'm +security.login.submit: Entra + +# Profile +profile.show.username: Nom d'usuari +profile.show.email: Correu electrònic +profile.edit.submit: Actualitza +profile.flash.updated: S'ha actualitzat el perfil + +# Password change +change_password.submit: Canvia la contrasenya +change_password.flash.success: S'ha canviat la contrasenya + +# Registration +registration.check_email: S'ha enviat un correu electrònic a %email%. Conté un enllaç d'activació que heu de clicar per activar el compte. +registration.confirmed: Enhorabona %username%, el vostre compte s'ha confirmat. +registration.back: Torna a la pàgina original. +registration.submit: Registra +registration.flash.user_created: S'ha creat l'usuari correctament + +registration.email: | + Benvingut %username%! + Hola %username%! + + Per finalitzar la validació del seu compte - si us plau visiteu %confirmationUrl% + + Atentament, + L'equip. + +# Password resetting +resetting.password_already_requested: La contrasenya per l'usuari ja ha estat sol·licitada en les últimes 24 hores. +resetting.check_email: S'ha enviat un correu electrònic a %email%. Conté un enllaç que heu de clicar per restablir la contrasenya. +resetting.request.invalid_username: El nom d'usuari o correu electrònic "%username%" no existeix. +resetting.request.username: "Nom d'usuari o correu electrònic:" +resetting.request.submit: Restableix la contrasenya +resetting.reset.submit: Canvia la contrasenya +resetting.flash.success: S'ha restablert la contrasenya correctament + +resetting.email: | + Restablir la contrasenya + Hola %username%! + + Per restablir la contrasenya - si us plau visiteu %confirmationUrl% + + Atentament, + L'equip. + +# Global strings +layout.logout: Tanca la sessió +layout.login: Entra +layout.register: Registrar-se +layout.logged_in_as: Heu iniciat sessió com a %username% + +# Form field labels +fos_user_group_form_name: "Nom del grup:" + +fos_user_profile_form_user_username: "Nom d'usuari:" +fos_user_profile_form_user_email: "Correu electrònic:" +fos_user_profile_form_current: "Contrasenya actual:" + +fos_user_registration_form_username: "Nom d'usuari:" +fos_user_registration_form_email: "Correu electrònic:" +fos_user_registration_form_plainPassword_first: "Contrasenya:" +fos_user_registration_form_plainPassword_second: "Verificació:" + +fos_user_resetting_form_new_first: "Nova contrasenya:" +fos_user_resetting_form_new_second: "Verificació:" + +fos_user_change_password_form_new_first: "Nova contrasenya:" +fos_user_change_password_form_new_second: "Verificació:" +fos_user_change_password_form_current: "Contrasenya actual:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.da.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.da.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Opdater gruppe group +group.show.name: Gruppe navn +group.new.submit: Opret gruppe +group.flash.updated: Gruppen er blevet opdateret +group.flash.created: Gruppen er blevet oprettet +group.flash.deleted: Gruppen er blevet slettet + +# Security +security.login.username: "Brugernavn:" +security.login.password: "Kodeord:" +security.login.remember_me: Husk mig +security.login.submit: Logind + +# Profile +profile.show.username: Brugernavn +profile.show.email: Email +profile.edit.submit: Opdater +profile.flash.updated: Profilen er blevet opdateret + +# Password change +change_password.submit: Skift kodeord +change_password.flash.success: Kodeordet er blevet opdateret + +# Registration +registration.check_email: En email er blevet send til %email%. Den indeholder et aktiverings link du skal bruge for at aktiverer din konto. +registration.confirmed: Tillykke %username%, din konto er nu aktiveret +#registration.back: Back to the originating page. +registration.submit: Registrer +registration.flash.user_created: Bruger er blevet oprettet + +registration.email: | + Velkommen %username%! + Hej %username%! + + For at færdiggøre valideringen af din konto - besøg venligst %confirmationUrl% + + Venlig Hilsen, + Holdet bag siden. + +# Password resetting +resetting.password_already_requested: Denne brugers kodeord er allerede blevet nulstillet inden for de sidste 24 timer. +resetting.check_email: En email er blevet sendt til %email%. Den indeholder et link til at nulstille dit kodeord. +resetting.request.invalid_username: Brugeren "%username" findes ikke. +resetting.request.username: "Brugernavn:" +resetting.request.submit: Nulstil kodeord +resetting.reset.submit: Skift kodeord +resetting.flash.success: Kodeordet er blevet nulstillet + +resetting.email: | + Velkommen %username%! + Hej %username%! + + For at nulstille dit kodeord - besøg venligst %confirmationUrl% + + Venlig Hilsen, + Holdet bag siden. + +# Global strings +layout.logout: Logud +layout.login: Logind +layout.register: Registrer +layout.logged_in_as: Logget ind som %username% + +# Form field labels +fos_user_group_form_name: "Gruppe navn:" + +fos_user_profile_form_user_username: "Brugernavn:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Nuværende kodeord:" + +fos_user_registration_form_username: "Brugernavn:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Kodeord:" +fos_user_registration_form_plainPassword_second: "Verificering:" + +fos_user_resetting_form_new_first: "Nyt kodeord:" +fos_user_resetting_form_new_second: "Verificering:" + +fos_user_change_password_form_new_first: "Nyt kodeord:" +fos_user_change_password_form_new_second: "Verificering:" +fos_user_change_password_form_current: "Nuværende kodeord:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.de.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.de.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Gruppe aktualisieren +group.show.name: Gruppenname +group.new.submit: Gruppe erstellen +group.flash.updated: Die Gruppe wurde aktualisiert +group.flash.created: Die Gruppe wurde erstellt +group.flash.deleted: Die Gruppe wurde gelöscht + +# Security +security.login.username: "Benutzername:" +security.login.password: "Passwort:" +security.login.remember_me: An mich erinnern +security.login.submit: Anmelden + +# Profile +profile.show.username: Benutzername +profile.show.email: E-Mail +profile.edit.submit: Benutzer aktualisieren +profile.flash.updated: Das Benutzerprofil wurde aktualisiert + +# Password change +change_password.submit: Passwort ändern +change_password.flash.success: Das Passwort wurde geändert + +# Registration +registration.check_email: Eine E-Mail wurde an %email% gesendet. Sie enthält einen Link, den Du anklicken musst, um Dein Benutzerkonto zu bestätigen. +registration.confirmed: Glückwunsch %username%, Dein Benutzerkonto ist jetzt bestätigt. +registration.back: Zurück zur ursprünglichen Seite. +registration.submit: Registrieren +registration.flash.user_created: Der Benutzer wurde erfolgreich erstellt + +registration.email: | + Willkommen %username%! + Hallo %username%! + + Besuche bitte folgende Seite, um Dein Benutzerkonto zu bestätigen: %confirmationUrl% + + Mit besten Grüßen, + das Team. + +# Password resetting +resetting.password_already_requested: Für diesen Benutzer wurde in den vergangenen 24 Stunden bereits ein neues Passwort beantragt. +resetting.check_email: Eine E-Mail wurde an %email% gesendet. Sie enthält einen Link, den Du anklicken musst, um Dein Passwort zurückzusetzen. +resetting.request.invalid_username: Der Benutzername oder die E-Mail-Adresse "%username%" existiert nicht. +resetting.request.username: "Benutzername oder E-Mail-Adresse:" +resetting.request.submit: Passwort zurücksetzen +resetting.reset.submit: Passwort ändern +resetting.flash.success: Das Passwort wurde erfolgreich zurückgesetzt + +resetting.email: | + Passwort zurücksetzen + Hallo %username%! + + Besuche bitte folgende Seite, um Dein Passwort zurückzusetzen: %confirmationUrl% + + Mit besten Grüßen, + das Team. + +# Global strings +layout.logout: Abmelden +layout.login: Anmelden +layout.register: Registrieren +layout.logged_in_as: Angemeldet als %username% + +# Form field labels +fos_user_group_form_name: "Gruppenname:" + +fos_user_profile_form_user_username: "Benutzername:" +fos_user_profile_form_user_email: "E-Mail-Adresse:" +fos_user_profile_form_current: "Derzeitiges Passwort:" + +fos_user_registration_form_username: "Benutzername:" +fos_user_registration_form_email: "E-Mail-Adresse:" +fos_user_registration_form_plainPassword_first: "Passwort:" +fos_user_registration_form_plainPassword_second: "Bestätigung:" + +fos_user_resetting_form_new_first: "Neues Passwort:" +fos_user_resetting_form_new_second: "Bestätigung:" + +fos_user_change_password_form_new_first: "Neues Passwort:" +fos_user_change_password_form_new_second: "Bestätigung:" +fos_user_change_password_form_current: "Derzeitiges Passwort:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.en.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.en.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Update group +group.show.name: Group name +group.new.submit: Create group +group.flash.updated: The group has been updated +group.flash.created: The group has been created +group.flash.deleted: The group has been deleted + +# Security +security.login.username: "Username:" +security.login.password: "Password:" +security.login.remember_me: Remember me +security.login.submit: Login + +# Profile +profile.show.username: Username +profile.show.email: Email +profile.edit.submit: Update +profile.flash.updated: The profile has been updated + +# Password change +change_password.submit: Change password +change_password.flash.success: The password has been changed + +# Registration +registration.check_email: An email has been sent to %email%. It contains an activation link you must click to activate your account. +registration.confirmed: Congrats %username%, your account is now confirmed. +registration.back: Back to the originating page. +registration.submit: Register +registration.flash.user_created: The user has been created successfully + +registration.email: | + Welcome %username%! + Hello %username%! + + To finish validating your account - please visit %confirmationUrl% + + Regards, + the Team. + +# Password resetting +resetting.password_already_requested: The password for this user has already been requested within the last 24 hours. +resetting.check_email: An email has been sent to %email%. It contains an link you must click to reset your password. +resetting.request.invalid_username: The username or email address "%username%" does not exist. +resetting.request.username: "Username or email address:" +resetting.request.submit: Reset password +resetting.reset.submit: Change password +resetting.flash.success: The password has been reset successfully + +resetting.email: | + Reset Password + Hello %username%! + + To reset your password - please visit %confirmationUrl% + + Regards, + the Team. + +# Global strings +layout.logout: Logout +layout.login: Login +layout.register: Register +layout.logged_in_as: Logged in as %username% + +# Form field labels +fos_user_group_form_name: "Group name:" + +fos_user_profile_form_user_username: "Username:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Current Password:" + +fos_user_registration_form_username: "Username:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Password:" +fos_user_registration_form_plainPassword_second: "Verification:" + +fos_user_resetting_form_new_first: "New password:" +fos_user_resetting_form_new_second: "Verification:" + +fos_user_change_password_form_new_first: "New password:" +fos_user_change_password_form_new_second: "Verification:" +fos_user_change_password_form_current: "Current password:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.es.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.es.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,83 @@ +# Group +group.edit.submit: Actualizar grupo +group.show.name: Nombre de grupo +group.new.submit: Crear grupo +group.flash.updated: El grupo ha sido actualizado +group.flash.created: El grupo ha sido creado +group.flash.deleted: El grupo ha sido borrado + +# Security +security.login.username: "Nombre de usuario:" +security.login.password: "Contraseña:" +security.login.remember_me: Recordar +security.login.submit: Entrar + +# Profile +profile.show.username: Nombre de usuario +profile.show.email: Email +profile.edit.submit: Actualizar usuario +profile.flash.updated: El perfil ha sido actualizado + +# Password change +change_password.submit: Cambiar contraseña +change_password.flash.success: La contraseña se ha cambiado con éxito + +# Registration +registration.check_email: Un email ha sido enviado a %email%. Contiene un enlace de activación que debes presionar para activar tu cuenta. +registration.confirmed: Felicidades %username%, tu cuenta está ahora confirmada. +registration.back: Volver a la página original. +registration.submit: Registrar +registration.flash.user_created: El usuario se ha creado satisfactoriamente + +registration.email: | + Bienvenido %username%! + Hola %username%! + + Para completar la validación de tu cuenta - por favor visita %confirmationUrl% + + Atentamente, + el Equipo. + +# Password resetting +resetting.password_already_requested: La contraseña para este usuario ya ha sido solicitada dentro de las 24 horas. +resetting.check_email: Un email ha sido enviado a %email%. Contiene un enlace de activación que debes presionar para restablecer tu contraseña. +resetting.request.invalid_username: El usuario o dirección de correo "%username%" no existe. +resetting.request.username: "Nombre de usuario:" +resetting.request.submit: Restablecer contraseña +resetting.reset.submit: Cambiar contraseña +resetting.flash.success: La contraseña se ha cambiado con éxito + +resetting.email: | + Bienvenido %username%! + Hola %username%! + + Para restablecer tu contraseña - por favor visita %confirmationUrl% + + Atentamente, + el Equipo. + +# Global strings +layout.logout: Salir +layout.login: Entrar +layout.register: Registrar +layout.logged_in_as: Entrado como %username% + +# Form field labels +fos_user_group_form_name: "Nombre de grupo:" + +fos_user_profile_form_user_username: "Nombre de usuario:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Actual contraseña:" + +fos_user_registration_form_username: "Nombre de usuario:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Contraseña:" +fos_user_registration_form_plainPassword_second: "Verificación:" + +fos_user_resetting_form_new_first: "Nueva contraseña:" +fos_user_resetting_form_new_second: "Verificación:" + +fos_user_change_password_form_new_first: "Nueva contraseña:" +fos_user_change_password_form_new_second: "Verificación:" +fos_user_change_password_form_current: "Actual contraseña:" + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.et.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.et.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,69 @@ +group.edit.submit: Muuda grupp +group.show.name: Grupi nimi +group.new.submit: Uus grupp + +security.login.username: "Kasutajanimi:" +security.login.password: "Salasõna:" +security.login.remember_me: Jäta mind meelde +security.login.submit: Sisene + +# Profile +profile.show.username: Kasutajanimi +profile.show.email: E-mail +profile.edit.submit: Uuenda + +# Password change +change_password.submit: Muuda salasõna + +# Registration +registration.check_email: E-mail on saadetud aadressile %email%. Selles sisaldub viide, mis tuleb konto aktiveerimiseks avada. +registration.confirmed: Palju õnne %username%, Sinu konto on aktiveeritud. +registration.submit: Registreeri + +registration.email: | + Tere %username%! + + Konto valideerimise edukaks lõpetamiseks palun vajutage viitel %confirmationUrl% + + Parimatega, + Tiim. + +# Password resetting +resetting.password_already_requested: Kasutaja salasõna on juba viimase 24 tunni jooksul küsitud. +resetting.check_email: E-mail on saadetud aadressile %email%. Selles sisaldub viide, mis tuleb salasõna muutmiseks avada. +resetting.request.username: "Kasutajanimi:" +resetting.request.submit: Saada salasõna +resetting.reset.submit: Muuda salasõna + +resetting.email: | + Tere %username%! + + Salasõna muutmiseks palun vajutage viitel %confirmationUrl% + + Parimatega, + Tiim. + +# Global strings +layout.logout: Välju +layout.login: Sisene +layout.register: Registreeri +layout.logged_in_as: "Sisse logitud: %username%" + +# Form field labels +fos_user_group_form_name: "Grupi nimi:" + +fos_user_profile_form_user_username: "Kasutajanimi:" +fos_user_profile_form_user_email: "E-mail:" +fos_user_profile_form_current: "Vana salasõna:" + +fos_user_registration_form_username: "Kasutajanimi:" +fos_user_registration_form_email: "E-mail:" +fos_user_registration_form_plainPassword_first: "Salasõna:" +fos_user_registration_form_plainPassword_second: "Salasõna uuesti:" + +fos_user_resetting_form_new_first: "Uus salasõna:" +fos_user_resetting_form_new_second: "Salasõna uuesti:" + +fos_user_change_password_form_new_first: "Uus salasõna:" +fos_user_change_password_form_new_second: "Salasõna uuesti:" +fos_user_change_password_form_current: "Vana salasõna:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.fr.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.fr.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,83 @@ +# Group +group.edit.submit: Mettre à jour le groupe +group.show.name: Nom du groupe +group.new.submit: Créer le groupe +group.flash.updated: Le groupe a été mis à jour +group.flash.created: Le groupe a été créé +group.flash.deleted: Le groupe a été supprimé + +# Security +security.login.username: "Nom d'utilisateur:" +security.login.password: "Mot de passe:" +security.login.remember_me: Se souvenir de moi +security.login.submit: Connexion + +# Profile +profile.show.username: Nom d'utilisateur +profile.show.email: Adresse e-mail +profile.edit.submit: Mettre à jour +profile.flash.updated: Le profil a été mis à jour + +# Password change +change_password.submit: Modifier le mot de passe +change_password.flash.success: Le mot de passe a été modifié + +# Registration +registration.check_email: Un e-mail a été envoyé à l'adresse %email%. Veuillez suivre les instructions qui vous y sont indiquées. +registration.confirmed: Félicitations %username%, votre compte est maintenant activé. +registration.back: Retour à la page d'origine. +registration.submit: Enregistrer +registration.flash.user_created: L'utilisateur a été créé avec succès + +registration.email: | + Bienvenue %username% ! + Bonjour %username% ! + + Pour valider votre compte utilisateur, merci de vous rendre sur %confirmationUrl% + + Cordialement, + L'équipe. + +# Password resetting +resetting.password_already_requested: Un nouveau mot de passe a déjà été demandé pour cet utilisateur dans les dernières 24 heures. +resetting.check_email: Un e-mail a été envoyé à l'adresse %email%. Veuillez suivre les instructions qui vous y sont indiquées. +resetting.request.invalid_username: Le nom d'utilisateur ou l'adresse e-mail "%username%" n'existe pas. +resetting.request.username: "Nom d'utilisateur ou adresse e-mail:" +resetting.request.submit: Réinitialiser le mot de passe +resetting.reset.submit: Modifier le mot de passe +resetting.flash.success: Le mot de passe a été réinitialisé avec succès + +resetting.email: | + Bienvenue %username% ! + Bonjour %username% ! + + Pour réinitialiser votre mot de passe, merci de vous rendre sur %confirmationUrl% + + Cordialement, + L'équipe. + +# Global strings +layout.logout: Déconnexion +layout.login: Connexion +layout.register: Enregistrer +layout.logged_in_as: Connecté en tant que %username% + +# Form field labels +fos_user_group_form_name: "Nom du groupe:" + +fos_user_profile_form_username: "Nom d'utilisateur:" +fos_user_profile_form_email: "Adresse e-mail:" +fos_user_profile_form_plainPassword_first: "Mot de passe:" +fos_user_profile_form_plainPassword_second: "Vérification:" + +fos_user_registration_form_username: "Nom d'utilisateur:" +fos_user_registration_form_email: "Adresse e-mail:" +fos_user_registration_form_plainPassword_first: "Mot de passe:" +fos_user_registration_form_plainPassword_second: "Vérification:" + +fos_user_resetting_form_new_first: "Nouveau mot de passe:" +fos_user_resetting_form_new_second: "Vérification:" + +fos_user_change_password_form_new_first: "Nouveau mot de passe:" +fos_user_change_password_form_new_second: "Vérification:" +fos_user_change_password_form_current: "Mot de passe actuel:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.hu.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.hu.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Csoport frissítése +group.show.name: Csoport név +group.new.submit: Csoport létrehozása +group.flash.updated: A csoport frissítve +group.flash.created: A csoport létrehozva +group.flash.deleted: A csoport törölve + +# Security +security.login.username: "Felhasználónév:" +security.login.password: "Jelszó:" +security.login.remember_me: Megjegyzés +security.login.submit: Belépés + +# Profile +profile.show.username: Felhasználónév +profile.show.email: E-mail +profile.edit.submit: Frissítés +profile.flash.updated: A profil frissítve + +# Password change +change_password.submit: Jelszó megváltoztazása +change_password.flash.success: A jelszó megváltoztatva + +# Registration +registration.check_email: Egy e-mail lett küldve a(z) %email% címre. Egy aktivációs linket tartalmaz, amire rá kell kattintani a fiók aktiválásához. +registration.confirmed: Gratulálunk %username%, a fiók visszaigazolva. +registration.back: Vissza az előző oldalra. +registration.submit: Regisztráció +registration.flash.user_created: A felhasználó sikeresen létrehozva + +registration.email: | + Üdvözöljük %username%! + Hello %username%! + + A fiókja visszaigazolásához kérjük látogasson el a következő linkre: %confirmationUrl% + + Üdvözlettel, + the Team. + +# Password resetting +resetting.password_already_requested: Az elmúlt 24 órában ehhez a felhasználóhoz már kértek új jelszót. +resetting.check_email: Egy e-mail lett küldve a(z) %email% címre. Egy linket tartalmaz, amire rá kell kattintani a jeszó lecseréléséhez. +resetting.request.invalid_username: A(z) %username% felhasználónév vagy e-mail cím nem létezik. +resetting.request.username: "Felhasználónév vagy e-mail cím:" +resetting.request.submit: Jelszó lecserélése +resetting.reset.submit: Jelszó megváltoztatása +resetting.flash.success: A jelszó sikeresen lecserélve + +resetting.email: | + Jelszó lecserélése + Hello %username%! + + A jelszó lecseréléséhez kérjük látogasson el a következő linkre: %confirmationUrl% + + Üdvözlettel, + the Team. + +# Global strings +layout.logout: Kijelentkezés +layout.login: Bejelentkezés +layout.register: Regisztráció +layout.logged_in_as: Belépve mint %username% + +# Form field labels +fos_user_group_form_name: "Csoport név:" + +fos_user_profile_form_user_username: "Felhasználónév:" +fos_user_profile_form_user_email: "E-mail:" +fos_user_profile_form_current: "Jelenlegi jelszó:" + +fos_user_registration_form_username: "Felhasználónév:" +fos_user_registration_form_email: "E-mail:" +fos_user_registration_form_plainPassword_first: "Jelszó:" +fos_user_registration_form_plainPassword_second: "Megerősítés:" + +fos_user_resetting_form_new_first: "Új jelszó:" +fos_user_resetting_form_new_second: "Megerősítés:" + +fos_user_change_password_form_new_first: "Új jelszó:" +fos_user_change_password_form_new_second: "Megerősítés:" +fos_user_change_password_form_current: "Jelenlegi jelszó:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.it.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.it.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Aggiorna gruppo +group.show.name: Nome gruppo +group.new.submit: Crea gruppo +group.flash.updated: Il gruppo è stato aggiornato +group.flash.created: Il gruppo è stato creato +group.flash.deleted: Il gruppo è stato cancellato + +# Security +security.login.username: "Username:" +security.login.password: "Password:" +security.login.remember_me: Ricordami +security.login.submit: Login + +# Profile +profile.show.username: Username +profile.show.email: Email +profile.edit.submit: Aggiorna +profile.flash.updated: Il profilo è stato aggiornato + +# Password change +change_password.submit: Cambia password +change_password.flash.success: La password è stata cambiata + +# Registration +registration.check_email: Una mail è stata inviata a %email%. Contiene il link d'attivazione che devi utilizzare per attivare il tuo account. +registration.confirmed: Congratulazioni %username%, il tuo account è confermato. +registration.back: Torna alla pagina d'origine. +registration.submit: Registra +registration.flash.user_created: Utente creato con successo + +registration.email: | + Benvenuto %username%! + Ciao %username%! + + Per terminare la validazione del tuo account visita %confirmationUrl% + + Saluti, + il Team. + +# Password resetting +resetting.password_already_requested: La password per questo utente è già stata richiesta nelle ultime 24 ore. +resetting.check_email: Una email è stata inviata a %email%. Contiene il link d'attivazione che devi utilizzare per il reset della password. +resetting.request.invalid_username: Username o indirizzo email "%username%" non esistente. +resetting.request.username: "Username o indirizzo email:" +resetting.request.submit: Password reset +resetting.reset.submit: Cambia password +resetting.flash.success: La password è stata resettata + +resetting.email: | + Password reset + Ciao %username%! + + Per resettare la password visita %confirmationUrl% + + Saluti, + il Team. + +# Global strings +layout.logout: Logout +layout.login: Login +layout.register: Registra +layout.logged_in_as: Collegato come %username% + +# Form field labels +fos_user_group_form_name: "Nome gruppo:" + +fos_user_profile_form_user_username: "Username:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Password corrente:" + +fos_user_registration_form_username: "Username:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Password:" +fos_user_registration_form_plainPassword_second: "Verifica:" + +fos_user_resetting_form_new_first: "Nuova password:" +fos_user_resetting_form_new_second: "Verifica:" + +fos_user_change_password_form_new_first: "Nuova password:" +fos_user_change_password_form_new_second: "Verifica:" +fos_user_change_password_form_current: "Password corrente:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ja.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ja.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: グループの更新 +group.show.name: グループ名 +group.new.submit: グループの作成 +group.flash.updated: グループが更新されました +group.flash.created: グループが作成されました +group.flash.deleted: グループが削除されました + +# Security +security.login.username: "ユーザー名:" +security.login.password: "パスワード:" +security.login.remember_me: ログイン状態を記憶する +security.login.submit: ログイン + +# Profile +profile.show.username: ユーザー名 +profile.show.email: メールアドレス +profile.edit.submit: 更新 +profile.flash.updated: プロフィールが更新されました + +# Password change +change_password.submit: パスワードの変更 +change_password.flash.success: パスワードが変更されました + +# Registration +registration.check_email: %email% 宛にメールを送信しました。メールに記載された確認 URL にアクセスして、アカウントを有効化してください。 +registration.confirmed: %username% さんのアカウントの確認が完了しました。 +registration.back: 元のページに戻る +registration.submit: 登録 +registration.flash.user_created: ユーザーの作成が完了しました + +registration.email: | + %username% さん、ようこそ! + こんにちは %username% さん! + + アカウントを有効化するには、次の確認 URL へアクセスしてください %confirmationUrl% + + + 開発チーム + +# Password resetting +resetting.password_already_requested: このユーザーのパスワードは 24 時間以内ですでにリクエストされています。 +resetting.check_email: %email% 宛にメールを送信しました。メールに記載された確認 URL にアクセスして、アカウントを有効化してください。 +resetting.request.invalid_username: "%username%" というユーザー名またはメールアドレスは存在しません。 +resetting.request.username: "ユーザー名かメールアドレス:" +resetting.request.submit: パスワードのリセット +resetting.reset.submit: パスワードの変更 +resetting.flash.success: パスワードのリセットが完了しました + +resetting.email: | + パスワードのリセット + こんにちは %username% さん! + + パスワードをリセットするには、次のリセット URL へアクセスしてください %confirmationUrl% + + + 開発チーム + +# Global strings +layout.logout: ログアウト +layout.login: ログイン +layout.register: 登録 +layout.logged_in_as: %username% でログイン中 + +# Form field labels +fos_user_group_form_name: "グループ名:" + +fos_user_profile_form_user_username: "ユーザー名:" +fos_user_profile_form_user_email: "メールアドレス:" +fos_user_profile_form_current: "現在のパスワード:" + +fos_user_registration_form_username: "ユーザー名:" +fos_user_registration_form_email: "メールアドレス:" +fos_user_registration_form_plainPassword_first: "パスワード:" +fos_user_registration_form_plainPassword_second: "確認:" + +fos_user_resetting_form_new_first: "新しいパスワード:" +fos_user_resetting_form_new_second: "確認:" + +fos_user_change_password_form_new_first: "新しいパスワード:" +fos_user_change_password_form_new_second: "確認:" +fos_user_change_password_form_current: "現在のパスワード:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.lb.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.lb.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Grupp aktualiséieren +group.show.name: Gruppennumm +group.new.submit: Grupp creéieren +group.flash.updated: D'Grupp gouf aktualiséiert +group.flash.created: D'Grupp gouf creéiert +group.flash.deleted: D'Grupp gouf geläscht + +# Security +security.login.username: "Benotzernumm:" +security.login.password: "Passwuert:" +security.login.remember_me: U mech erënneren +security.login.submit: Umellen + +# Profile +profile.show.username: Benotzernumm +profile.show.email: E-Mail +profile.edit.submit: Benotzer aktualiséieren +profile.flash.updated: De Benotzerprofil gouf aktualiséiert + +# Password change +change_password.submit: Passwuert ännern +change_password.flash.success: D'Passwuert gouf geännert + +# Registration +registration.check_email: Eng E-Mail gouf un %email% geschéckt. Se enthält e Link deen s Du uklicke muss, fir Däi Benotzerkonto ze bestätegen. +registration.confirmed: Gléckwonsch %username%, Däi Benutzerkonto ass elo bestätegt. +#registration.back: Back to the originating page. +registration.submit: Registréieren +registration.flash.user_created: De Benotzer gouf erfollegräich creéiert + +registration.email: | + Wëllkomm %username%! + Hallo %username%! + + Fir Däi Benotzerkonto ze bestätegen, besich wann ech gelift d'Säit %confirmationUrl% + + Mat beschte Gréiss, + d'Equipe. + +# Password resetting +resetting.password_already_requested: Een neit Passwuert gouf an de vergaangene 24 Stunden fir dëse Benotzer schon emol ugefrot. +resetting.check_email: Eng E-Mail gouf un %email% geschéckt. Se enthält e Link, deen s Du uklicke muss, fir Däi Passwort zeréckzesetzen. +resetting.request.invalid_username: De Benotzer "%username%" existéiert net. +resetting.request.username: "Benotzernumm:" +resetting.request.submit: Passwuert zerécksetzen +resetting.reset.submit: Passwuert ännern +resetting.flash.success: D'Passwuert gouf erfollegräich zeréckgesat + +resetting.email: | + Wëllkomm %username%! + Hallo %username%! + + Fir Däi Passwuert zeréckzesetzen, besich wann ech gelift d'Säit %confirmationUrl% + + Mat beschte Gréiss, + d'Equipe. + +# Global strings +layout.logout: Ofmellen +layout.login: Umellen +layout.register: Registréieren +layout.logged_in_as: Ugemellt als %username% + +# Form field labels +fos_user_group_form_name: "Gruppennumm:" + +fos_user_profile_form_user_username: "Benotzernumm:" +fos_user_profile_form_user_email: "E-Mail-Adress:" +fos_user_profile_form_current: "Aktuellt Passwuert:" + +fos_user_registration_form_username: "Benotzernumm:" +fos_user_registration_form_email: "E-Mail-Adress:" +fos_user_registration_form_plainPassword_first: "Passwuert:" +fos_user_registration_form_plainPassword_second: "Bestätegung:" + +fos_user_resetting_form_new_first: "Neit Passwuert:" +fos_user_resetting_form_new_second: "Bestätegung:" + +fos_user_change_password_form_new_first: "Neit Passwuert:" +fos_user_change_password_form_new_second: "Bestätegung:" +fos_user_change_password_form_current: "Aktuellt Passwuert:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.nl.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.nl.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,81 @@ +# Group +group.edit.submit: Groep bijwerken +group.show.name: Groep naam +group.new.submit: Groep aanmaken +group.flash.updated: De groep is bijgewerkt +group.flash.created: De groep is aangemaakt +group.flash.deleted: De groep is verwijderd + +# Security +security.login.username: "Gebruikersnaam:" +security.login.password: "Wachtwoord:" +security.login.remember_me: Onthoud mijn gegevens +security.login.submit: Inloggen + +# Profile +profile.show.username: Gebruikersnaam +profile.show.email: Email +profile.edit.submit: Bijwerken +profile.flash.updated: Het profiel is bijgewerkt + +# Password change +change_password.submit: Wachtwoord wijzigen + +# Registration +registration.check_email: Er is een email gestuurd naar %email%. Het bevat een activatielink die u moet aanklikken om uw account te activeren. +registration.confirmed: Gefeliciteerd %username%, uw account is nu bevestigd. +#registration.back: Back to the originating page. +registration.submit: Registreer +registration.flash.user_created: De gebruiker is succesvol aangemaakt + +registration.email: | + Welkom %username%! + Hallo %username%! + + U moet uw account nog valideren, ga naar %confirmationUrl% + + Vriendelijke groeten, + het Team. + +# Password resetting +resetting.password_already_requested: Het wachtwoord voor deze gebruiker is al aangevraagd in de laatste 24 uur. +resetting.check_email: Er is een email gestuurd naar %email%. Het bevat een link om uw wachtwoord te resetten.. +resetting.request.invalid_username: De gebruiker "%username%" bestaat niet. +resetting.request.username: "Gebruikersnaam:" +resetting.request.submit: Reset wachtwoord +resetting.reset.submit: Wachtwoord bijwerken +resetting.flash.success: Het wachtworod is succesvol gereset + +resetting.email: | + Welkom %username%! + Hallo %username%! + + Om uw wachtwoord te resetten gaat u naar de volgende link %confirmationUrl% + + Met vriendelijke groet, + het Team. + +# Global strings +layout.logout: Uitloggen +layout.login: Inloggen +layout.register: Registreer +layout.logged_in_as: Ingelogd als %username% + +# Form field labels +fos_user_group_form_name: "Groep naam:" + +fos_user_profile_form_user_username: "Gebruikersnaam:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Huidig wachtwoord:" + +fos_user_registration_form_username: "Gebruikersnaam:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Wachtwoord:" +fos_user_registration_form_plainPassword_second: "Verificatie:" + +fos_user_resetting_form_new_first: "Nieuw wachtwoord:" +fos_user_resetting_form_new_second: "Verificatie:" + +fos_user_change_password_form_new_first: "Nieuw wachtwoord:" +fos_user_change_password_form_new_second: "Verificatie:" +fos_user_change_password_form_current: "Huidig wachtwoord:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pl.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pl.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Edytuj grupę +group.show.name: Nazwa grupy +group.new.submit: Utwórz grupę +group.flash.updated: Grupa została zaktualizowana +group.flash.created: Grupa została utworzona +group.flash.deleted: Grupa została usunięta + +# Security +security.login.username: "Nazwa użytkownika:" +security.login.password: "Hasło:" +security.login.remember_me: Nie wylogowuj mnie +security.login.submit: Zaloguj + +# Profile +profile.show.username: Nazwa użytkownika +profile.show.email: E-mail +profile.edit.submit: Edytuj użytkownika +profile.flash.updated: Zapisano zmiany w profilu + +# Password change +change_password.submit: Zmień hasło +change_password.flash.success: Hasło zostało zmienione + +# Registration +registration.check_email: Na adres %email% wysłano wiadomość e-mail. Zawiera ona link w którego należy kliknąć aby aktywować konto. +registration.confirmed: Gratulacje %username%, potwierdziłeś konto. +#registration.back: Back to the originating page. +registration.submit: Zarejestruj +registration.flash.user_created: Stworzono użytkownika + +registration.email: | + Witaj %username%! + Cześć %username%! + + Aby potwierdzić swoje konto - proszę przejść do %confirmationUrl% + + Pozdrawiamy, + Zespół. + +# Password resetting +resetting.password_already_requested: W przeciągu ostatnich 24 godzin nastąpiła już próba odzyskania hasła. +resetting.check_email: Na adres %email% Wysłano wiadomość e-mail. Zawiera ona link w którego należy kliknąć aby zresetować hasło. +resetting.request.invalid_username: Użytkownik "%username%" nie istnieje. +resetting.request.username: "Nazwa użytkownika:" +resetting.request.submit: Resetuj hasło +resetting.reset.submit: Zmień hasło +resetting.flash.success: Hasło zostało zresetowane + +resetting.email: | + Witaj %username%! + Cześć %username%! + + Aby zresetować hasło - proszę przejść do %confirmationUrl% + + Pozdrawiamy, + Zespół. + +# Global strings +layout.logout: Wyloguj +layout.login: Zaloguj +layout.register: Zarejestruj +layout.logged_in_as: Zalogowano jako %username% + +# Form field labels +fos_user_group_form_name: "Nazwa grupy:" + +fos_user_profile_form_user_username: "Nazwa użytkownika:" +fos_user_profile_form_user_email: "E-mail:" +fos_user_profile_form_current: "Obecne hasło:" + +fos_user_registration_form_username: "Nazwa użytkownika:" +fos_user_registration_form_email: "E-mail:" +fos_user_registration_form_plainPassword_first: "Hasło:" +fos_user_registration_form_plainPassword_second: "Weryfikacja:" + +fos_user_resetting_form_new_first: "Nowe hasło:" +fos_user_resetting_form_new_second: "Weryfikacja:" + +fos_user_change_password_form_new_first: "Nowe hasło:" +fos_user_change_password_form_new_second: "Weryfikacja:" +fos_user_change_password_form_current: "Obecne hasło:" \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pt_BR.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pt_BR.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Atualizar Grupo +group.show.name: Nome do Grupo +group.new.submit: Criar Grupo +group.flash.updated: O grupo foi atualizado +group.flash.created: O grupo foi criado +group.flash.deleted: O grupo foi removido + +# Security +security.login.username: "Usuário:" +security.login.password: "Senha:" +security.login.remember_me: Permanecer conectado +security.login.submit: Entrar + +# Profile +profile.show.username: Usuário +profile.show.email: Email +profile.edit.submit: Atualizar +profile.flash.updated: O perfil foi atualizado. + +# Password change +change_password.submit: Alterar senha +change_password.flash.success: A senha foi alterada. + +# Registration +registration.check_email: Um email foi enviado para o endereço %email%. Para para ativar a sua conta, clique no link na mensagem. +registration.confirmed: Parabéns, %username%. A sua conta foi ativada. +registration.back: Retornar para a página de origem. +registration.submit: Registrar +registration.flash.user_created: O usuário foi criado com sucesso. + +registration.email: | + Bem-vindo(a), %username%! + Olá, %username%! + + Para completar a validação da sua conta, clique no link: %confirmationUrl% + + Atenciosamente, + a Equipe. + +# Password resetting +resetting.password_already_requested: Este usuário já solicitou uma senha nas últimas 24 horas. +resetting.check_email: Foi enviado um email para %email%. Para recuperar a sua senha, clique no link da mensagem. +resetting.request.invalid_username: O usuário ou endereço de email "%username%" não está cadastrado. +resetting.request.username: "Usuário ou email:" +resetting.request.submit: Recuperar senha +resetting.reset.submit: Alterar senha +resetting.flash.success: A senha foi redefinida com sucesso. + +resetting.email: | + Redefinir senha + Olá, %username%! + + Para redefinir sua senha, clique no link: %confirmationUrl% + + Atenciosamente, + a Equipe. + +# Global strings +layout.logout: Sair +layout.login: Entrar +layout.register: Registar +layout.logged_in_as: Conectado como %username% + +# Form field labels +fos_user_group_form_name: "Nome do Grupo:" + +fos_user_profile_form_user_username: "Usuário:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Senha atual:" + +fos_user_registration_form_username: "Usuário:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Senha:" +fos_user_registration_form_plainPassword_second: "Repita a senha:" + +fos_user_resetting_form_new_first: "Nova senha:" +fos_user_resetting_form_new_second: "Repita a senha:" + +fos_user_change_password_form_new_first: "Nova senha:" +fos_user_change_password_form_new_second: "Repita a senha:" +fos_user_change_password_form_current: "Senha atual:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pt_PT.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.pt_PT.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Atualizar Grupo +group.show.name: Nome do Grupo +group.new.submit: Criar Grupo +#group.flash.updated: The group has been updated +#group.flash.created: The group has been created +#group.flash.deleted: The group has been deleted + +# Security +security.login.username: "Utilizador:" +security.login.password: "Password:" +security.login.remember_me: Lembrar-me +security.login.submit: Entrar + +# Profile +profile.show.username: Utilizador +profile.show.email: Email +profile.edit.submit: Atualizar conta +#profile.flash.updated: The profile has been updated + +# Password change +change_password.submit: Mudar a password +#change_password.flash.success: The password has been changed + +# Registration +registration.check_email: Foi enviado um email para %email%. Este contém um link de ativação que terá de visitar para ativar a sua conta. +registration.confirmed: Parabéns %username%, a sua conta foi confirmada. +#registration.back: Back to the originating page. +registration.submit: Registar +#registration.flash.user_created: The user has been created successfully + +registration.email: | + Bem-vindo(a) %username%! + Olá %username%! + + Para completar a validação da sua conta, por favor visite o seguinte link: %confirmationUrl% + + Cumprimentos, + A equipa. + +# Password resetting +resetting.password_already_requested: Uma password para este utilizador já foi requisitada nas últimas 24 horas. +resetting.check_email: Foi enviado um email para %email%. Este contém um link que terá de visitar para puder recuperar a sua password. +#resetting.request.invalid_username: The username or email address "%username%" does not exist. +resetting.request.username: "Utilizador:" +resetting.request.submit: Recuperar password +resetting.reset.submit: Alterar passord +#resetting.flash.success: The password has been reset successfully + +resetting.email: | + Bem-vindo(a) %username%! + Olá %username%! + + Para recuperar a password, por favor visite o seguinte link: %confirmationUrl% + + Cumprimentos, + A equipa. + +# Global strings +layout.logout: Sair +layout.login: Entrar +layout.register: Registar +layout.logged_in_as: Entrou como %username% + +# Form field labels +fos_user_group_form_name: "Nome do Grupo:" + +fos_user_profile_form_user_username: "Utilizador:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Password atual:" + +fos_user_registration_form_username: "Utilizador:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Password:" +fos_user_registration_form_plainPassword_second: "Verificar:" + +fos_user_resetting_form_new_first: "Nova password:" +fos_user_resetting_form_new_second: "Verificar:" + +fos_user_change_password_form_new_first: "Nova password:" +fos_user_change_password_form_new_second: "Verificar:" +fos_user_change_password_form_current: "Password atual:" \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ro.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ro.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,83 @@ +# Group +group.edit.submit: Updateaza grupul +group.show.name: Numele grupului +group.new.submit: Creeaza grup +group.flash.updated: Grupul a fost updatat +group.flash.created: Grupul a fost creat +group.flash.deleted: Grupul a fost sters + +# Security +security.login.username: "Nume de utilizator:" +security.login.password: "Parola:" +security.login.remember_me: Tine-ma minte +security.login.submit: Login + +# Profile +profile.show.username: Numele de utilizator +profile.show.email: Email +profile.edit.submit: Updateaza +profile.flash.updated: Profilul a fost updatat + +# Password change +change_password.submit: Schimba parola +change_password.flash.success: Parola a fost schimbata + +# Registration +registration.check_email: Un email a fost trimis catre %email%. Contine un link de activare pe care trebuie sa il accesezi pentru a-ti activa contul. +registration.confirmed: Felicitari %username%, contul tau a fost confirmat. +registration.back: Inapoi la pagina de la care ai venit. +registration.submit: Inregistreaza-te +registration.flash.user_created: Utilizatorul a fost creat cu succes + +registration.email: | + Bine ai venit %username%! + Salut %username%! + + Pentru a-ti valida contul - acceseaza %confirmationUrl% + + Toate cele bune, + Echipa + +# Password resetting +resetting.password_already_requested: Deja s-a facut o cerere in ultimele 24 de ore pentru parola acestui utilizator. +resetting.check_email: A fost trimit un email catre %email%. Contine un link pe care trebuie sa il accesezi pentru a-ti reseta parola. +resetting.request.invalid_username: Numele de utilizator sau adresa de email "%username%" nu exista. +resetting.request.username: "Numele de utilizator sau adresa de email:" +resetting.request.submit: Reseteaza parola +resetting.reset.submit: Schimba parola +resetting.flash.success: Parola a fost resetata cu succes + +resetting.email: | + Resetare parola + Salut %username%! + + Pentru a-ti reseta parola - acceseaza %confirmationUrl% + + Toate cele bune, + Echipa + +# Global strings +layout.logout: Logout +layout.login: Login +layout.register: Inregistrare +layout.logged_in_as: Logat ca %username% + +# Form field labels +fos_user_group_form_name: "Numele grupului:" + +fos_user_profile_form_user_username: "Nume de utilizator:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Parola curenta:" + +fos_user_registration_form_username: "Numele de utilizator:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Parola:" +fos_user_registration_form_plainPassword_second: "Verificare parola:" + +fos_user_resetting_form_new_first: "Noua parola:" +fos_user_resetting_form_new_second: "Verificare parola:" + +fos_user_change_password_form_new_first: "Noua parola:" +fos_user_change_password_form_new_second: "Verificare parola:" +fos_user_change_password_form_current: "Parola curenta:" + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ru.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.ru.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Обновить группу +group.show.name: Название группы +group.new.submit: Создать группу +group.flash.updated: Группа обновлена +group.flash.created: Группа создана +group.flash.deleted: Группа удалена + +# Security +security.login.username: "Имя пользователя:" +security.login.password: "Пароль:" +security.login.remember_me: Запомнить меня +security.login.submit: Войти +profile.flash.updated: Профиль пользователя обновлен + +# Profile +profile.show.username: Имя пользователя +profile.show.email: Электронная почта +profile.edit.submit: Обновить + +# Password change +change_password.submit: Изменить пароль +change_password.flash.success: Пароль изменен + +# Registration +registration.check_email: Письмо отправлено на адрес %email%. В нём содержится ссылка, по которой вы можете подтвердить свою регистрацию. +registration.confirmed: Поздравляем %username%, ваш аккаунт подтвержден. +#registration.back: Back to the originating page. +registration.submit: Регистрация +registration.flash.user_created: Пользователь успешно создан + +registration.email: | + Добро пожаловать %username%! + Привествуем %username%! + + Для подтверждения вашей регистрации, пройдите по ссылке %confirmationUrl% + + С наилучшими пожеланиями, + команда сайта. + +# Password resetting +resetting.password_already_requested: Пароль для данного пользователя уже запрашивался за последние 24 часа. +resetting.check_email: Письмо на адрес %email% уже отправлено. Оно содержит ссылку, при переходе по которой ваш пароль будет сброшен. +resetting.request.invalid_username: Пользователь "%username%" не существует. +resetting.request.username: "Имя пользователя:" +resetting.request.submit: Сбросить пароль +resetting.reset.submit: Изменить пароль +resetting.flash.success: Пароль успешно сброшен + +resetting.email: | + Сброс пароля + Привествуем %username%! + + Для сброса пароля - пожалуйста пройдите по ссылке %confirmationUrl% + + С наилучшими пожеланиями, + команда сайта. + +# Global strings +layout.logout: Выход +layout.login: Вход +layout.register: Регистрация +layout.logged_in_as: Вы вошли как %username% + +# Form field labels +fos_user_group_form_name: "Название группы:" + +fos_user_profile_form_user_username: "Имя пользователя:" +fos_user_profile_form_user_email: "Электронная почта:" +fos_user_profile_form_current: "Текущий пароль:" + +fos_user_registration_form_username: "Имя пользователя:" +fos_user_registration_form_email: "Электронная почта:" +fos_user_registration_form_plainPassword_first: "Пароль:" +fos_user_registration_form_plainPassword_second: "Подтвердите пароль:" + +fos_user_resetting_form_new_first: "Новый пароль:" +fos_user_resetting_form_new_second: "Подтвердите пароль:" + +fos_user_change_password_form_new_first: "Новый пароль:" +fos_user_change_password_form_new_second: "Подтвердите пароль:" +fos_user_change_password_form_current: "Текущий пароль:" \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.sk.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.sk.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,82 @@ +# Group +group.edit.submit: Upraviť skupinu +group.show.name: Názov skupiny +group.new.submit: Vytvoriť skupinu +group.flash.updated: Skupina bola úspešne zmenená. +group.flash.created: Skupina bola úspešne vytvorená. +group.flash.deleted: Skupina bola úspešne vymazaná. + +# Security +security.login.username: "Užívateľské meno:" +security.login.password: "Heslo:" +security.login.remember_me: Zapamätať si +security.login.submit: Prihlásenie + +# Profile +profile.show.username: Užívateľské meno +profile.show.email: Email +profile.edit.submit: Upraviť +profile.flash.updated: Profil bol uspešne zmenený. + +# Password change +change_password.submit: Zmena hesla +change_password.flash.success: Heslo bolo úspešne zmenené + +# Registration +registration.check_email: Aktivačný email bol zaslaný na adresu %email%. V tele správy je aktivačná linka, na ktorú treba kliknúť pre úspešné dokončenie registrácie. +registration.confirmed: Gratulujeme %username%, Vaše konto bolo aktivované. +registration.back: Návrat na predchádzajúcu stránku. +registration.submit: Registrácia +registration.flash.user_created: Vaše konto bolo úspešne vytvorené. + +registration.email: | + Vitaj %username%! + Ahoj %username%! + + Pre ukončenie registrácie, prosím klikni na nasledovnú linku: %confirmationUrl% + + S pozdravom, + Realizačný tím + +# Password resetting +resetting.password_already_requested: Požiadavka na heslo už bola vykonaná za posledných 24 hodín. +resetting.check_email: Postup pre zmenu hesla bol zaslaný na adresu %email%. Správa obsahuje linku, na ktorú treba kliknúť pre úspešné dokončenie zmeny hesla. +resetting.request.invalid_username: Užívateľské meno alebo emailová adresa "%username%" neexistuje. Skontrolujte si prosím Vami zadané údaje a skúste znovu. +resetting.request.username: "Užívateľské meno alebo emailová adresa:" +resetting.request.submit: Obnova hesla +resetting.reset.submit: Zmeniť heslo +resetting.flash.success: Heslo bolo úspešne zmenené. + +resetting.email: | + Vynulovanie hesla + Ahoj %username%! + + Pre zmenu hesla, klikni prosím na nasledovnú linku: %confirmationUrl% + + S pozdravom, + Realizačný tím + +# Global strings +layout.logout: Odhlásenie +layout.login: Prihlásenie +layout.register: Registrácia +layout.logged_in_as: Ste prihlásený ako %username% + +# Form field labels +fos_user_group_form_name: "Názov skupiny:" + +fos_user_profile_form_user_username: "Užívateľské meno:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Súčasné heslo:" + +fos_user_registration_form_username: "Užívateľské meno:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Heslo:" +fos_user_registration_form_plainPassword_second: "Potvrdenie hesla:" + +fos_user_resetting_form_new_first: "Nové heslo:" +fos_user_resetting_form_new_second: "Potvrdenie hesla:" + +fos_user_change_password_form_new_first: "Nové heslo:" +fos_user_change_password_form_new_second: "Potvrdenie hesla:" +fos_user_change_password_form_current: "Súčasné heslo:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.sl.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/translations/FOSUserBundle.sl.yml Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,81 @@ +# Group +group.edit.submit: Shrani +group.show.name: Ime skupine +group.new.submit: Shrani +group.flash.updated: Skupina je bila uspešno shranjena +group.flash.created: Skupina je bila uspešno ustvarjena +group.flash.deleted: Skupina je bila uspešno izbrisana + +# Security +security.login.username: "Uporabniško ime:" +security.login.password: "Geslo:" +security.login.remember_me: Zapomni si me +security.login.submit: Prijava + +# Profile +profile.show.username: Uporabniško ime +profile.show.email: Email +profile.edit.submit: Shrani +profile.flash.updated: Profil je bila uspešno shranjen + +# Password change +change_password.submit: Spremeni geslo +change_password.flash.success: Geslo je bilo uspešno spremenjeno + +# Registration +registration.check_email: Na %email% smo vam poslali sporočilo s kodo za aktivacijo. Račun aktivirate s klikom na to povezavo. +registration.confirmed: Pozdravljeni %username%, vaš račun je sedaj aktiviran. +registration.back: Nazaj na prvotno stran. +registration.submit: Registracija +registration.flash.user_created: Uporabnik je bil uspešno ustvarjen + +registration.email: | + Aktivacija računa + Pozdravljeni %username%! + + Za aktivacijo računa prosim obiščite %confirmationUrl% + + lp, + ekipa. + +# Password resetting +resetting.password_already_requested: V zadnjih 24h ste že zahtevali ponastavitev gesla. +resetting.check_email: Na %email% smo vam poslali sporočilo s kodo za ponastavitev gesla. Geslo boste ponastavili po kliku na to povezavo. +resetting.request.invalid_username: Uporabnik z uporabniškim imenom "%username%" ne obstaja. +resetting.request.username: "Uporabniško ime:" +resetting.request.submit: Ponastavi geslo +resetting.reset.submit: Spremeni geslo + +resetting.email: | + Ponastavitev gesla + Pozdravljeni %username%! + + Za ponastavitev gesla prosim obiščite %confirmationUrl% + + lp, + ekipa. + +# Global strings +layout.logout: Odjava +layout.login: Prijava +layout.register: Registracija +layout.logged_in_as: Prijavljen kot %username% + +# Form field labels +fos_user_group_form_name: "Ime skupine:" + +fos_user_profile_form_user_username: "Uporabniško ime:" +fos_user_profile_form_user_email: "Email:" +fos_user_profile_form_current: "Trenutno geslo:" + +fos_user_registration_form_username: "Uporabniško ime:" +fos_user_registration_form_email: "Email:" +fos_user_registration_form_plainPassword_first: "Geslo:" +fos_user_registration_form_plainPassword_second: "Trenutno geslo:" + +fos_user_resetting_form_new_first: "Novo geslo:" +fos_user_resetting_form_new_second: "Preverjanje gesla:" + +fos_user_change_password_form_new_first: "Novo geslo:" +fos_user_change_password_form_new_second: "Preverjanje gesla:" +fos_user_change_password_form_current: "Trenutno geslo:" diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/ChangePassword/changePassword.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/ChangePassword/changePassword.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:ChangePassword:changePassword_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/ChangePassword/changePassword_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/ChangePassword/changePassword_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,8 @@ +{% form_theme form theme %} + +
+ {{ form_widget(form) }} +
+ +
+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/edit.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/edit.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Group:edit_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/edit_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/edit_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +{% form_theme form theme %} +
+ {{ form_widget(form) }} +
+ +
+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/list.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/list.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Group:list_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/list_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/list_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +
+ +
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/new.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/new.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Group:new_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/new_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/new_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +{% form_theme form theme %} +
+ {{ form_widget(form) }} +
+ +
+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/show.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/show.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Group:show_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Group/show_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Group/show_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,3 @@ +
+

{{ 'group.show.name'|trans([], 'FOSUserBundle') }}: {{ group.getName() }}

+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Profile/edit.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Profile/edit.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Profile:edit_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Profile/edit_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Profile/edit_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,8 @@ +{% form_theme form theme %} + + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Profile/show.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Profile/show.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Profile:show_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Profile/show_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Profile/show_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,4 @@ +
+

{{ 'profile.show.username'|trans({}, 'FOSUserBundle') }}: {{ user.username }}

+

{{ 'profile.show.email'|trans({}, 'FOSUserBundle') }}: {{ user.email }}

+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Registration/checkEmail.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Registration/checkEmail.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +

{{ 'registration.check_email'|trans({'%email%': user.email}, 'FOSUserBundle') }}

+{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Registration/confirmed.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Registration/confirmed.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,9 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +

{{ 'registration.confirmed'|trans({'%username%': user.username}, 'FOSUserBundle') }}

+ {% if app.session is not empty %} + {% set targetUrl = app.session.get('_security.target_path') %} + {% if targetUrl is not empty %}

{{ 'registration.back'|trans({}, 'FOSUserBundle') }}

{% endif %} + {% endif %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Registration/email.txt.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Registration/email.txt.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,3 @@ +{% autoescape false %} +{{ 'registration.email'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }} +{% endautoescape %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Registration/register.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Registration/register.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Registration:register_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Registration/register_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Registration/register_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,8 @@ +{% form_theme form theme %} + +
+ {{ form_widget(form) }} +
+ +
+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/checkEmail.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/checkEmail.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +

+{{ 'resetting.check_email'|trans({'%email%': user.email}, 'FOSUserBundle') }} +

+{% endblock %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/email.txt.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/email.txt.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,3 @@ +{% autoescape false %} +{{ 'resetting.email'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }} +{% endautoescape %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +

{{ 'resetting.password_already_requested'|trans({}, 'FOSUserBundle') }}

+{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/request.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/request.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Resetting:request_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/request_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/request_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,12 @@ +
+
+ {% if invalid_username is defined %} +

{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}, 'FOSUserBundle') }}

+ {% endif %} + + +
+
+ +
+
\ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/reset.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/reset.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,5 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% include "FOSUserBundle:Resetting:reset_content.html.twig" %} +{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Resetting/reset_content.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Resetting/reset_content.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,7 @@ +{% form_theme form theme %} +
+ {{ form_widget(form) }} +
+ +
+
diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/Security/login.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/Security/login.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,20 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} +{% if error %} +
{{ error }}
+{% endif %} + +
+ + + + + + + + + + +
+{% endblock fos_user_content %} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/form.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/form.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,6 @@ + +{% block field_label %} +{% spaceless %} + +{% endspaceless %} +{% endblock field_label %} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Resources/views/layout.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Resources/views/layout.html.twig Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,29 @@ + + + + + + +
+ {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %} + {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} | + + {{ 'layout.logout'|trans({}, 'FOSUserBundle') }} + + {% else %} + {{ 'layout.login'|trans({}, 'FOSUserBundle') }} + {% endif %} +
+ + {% for key, message in app.session.getFlashes() %} +
+ {{ message|trans({}, 'FOSUserBundle') }} +
+ {% endfor %} + +
+ {% block fos_user_content %} + {% endblock fos_user_content %} +
+ + diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Security/Encoder/EncoderFactory.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Security/Encoder/EncoderFactory.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Security\Encoder; + +use FOS\UserBundle\Model\UserInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface; + +/** + * This factory assumes MessageDigestPasswordEncoder's constructor. + * + * @author Johannes M. Schmitt + * @author Jeremy Mikola + */ +class EncoderFactory implements EncoderFactoryInterface +{ + protected $encoders; + protected $encoderClass; + protected $encodeHashAsBase64; + protected $iterations; + protected $genericFactory; + + /** + * Constructor. + * + * @param string $encoderClass Encoder class + * @param Boolean $encodeHashAsBase64 + * @param integer $iterations + * @param EncoderFactoryInterface $genericFactory + */ + public function __construct($encoderClass, $encodeHashAsBase64, $iterations, EncoderFactoryInterface $genericFactory) + { + $this->encoders = array(); + $this->encoderClass = $encoderClass; + $this->encodeHashAsBase64 = $encodeHashAsBase64; + $this->iterations = $iterations; + $this->genericFactory = $genericFactory; + } + + /** + * @see Symfony\Component\Security\Core\Encoder\EncoderFactory::getEncoder() + */ + public function getEncoder(SecurityUserInterface $user) + { + if (!$user instanceof UserInterface) { + return $this->genericFactory->getEncoder($user); + } + + if (isset($this->encoders[$algorithm = $user->getAlgorithm()])) { + return $this->encoders[$algorithm]; + } + + return $this->encoders[$algorithm] = $this->createEncoder($algorithm); + } + + /** + * Creates an encoder for the given algorithm. + * + * @param string $algorithm + * @return PasswordEncoderInterface + */ + protected function createEncoder($algorithm) + { + $class = $this->encoderClass; + + return new $class( + $algorithm, + $this->encodeHashAsBase64, + $this->iterations + ); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Security/InteractiveLoginListener.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Security/InteractiveLoginListener.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Security; + +use FOS\UserBundle\Model\UserManagerInterface; +use FOS\UserBundle\Model\UserInterface; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use DateTime; + +class InteractiveLoginListener +{ + protected $userManager; + + public function __construct(UserManagerInterface $userManager) + { + $this->userManager = $userManager; + } + + public function onSecurityInteractiveLogin(InteractiveLoginEvent $event) + { + $user = $event->getAuthenticationToken()->getUser(); + + if ($user instanceof UserInterface) { + $user->setLastLogin(new DateTime()); + $this->userManager->updateUser($user); + } + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/CouchDocument/UserManagerTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/CouchDocument/UserManagerTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,83 @@ +markTestSkipped('Doctrine CouchDB has to be installed for this test to run.'); + } + + $c = $this->getMock('FOS\UserBundle\Util\CanonicalizerInterface'); + $ef = $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface'); + + $class = new ClassMetadata(self::USERTYPE); + $class->mapField(array('fieldName' => 'username')); + + $this->dm = $this->getMock('Doctrine\ODM\CouchDB\DocumentManager', array('getRepository', 'persist', 'remove', 'flush', 'getClassMetadata'), array(), '', false); + $this->repository = $this->getMock('Doctrine\ODM\CouchDB\DocumentRepository', array('findBy', 'findAll'), array(), '', false); + $this->dm->expects($this->any()) + ->method('getRepository') + ->with($this->equalTo(self::USERTYPE)) + ->will($this->returnValue($this->repository)); + $this->dm->expects($this->any()) + ->method('getClassMetadata') + ->with($this->equalTo(self::USERTYPE)) + ->will($this->returnValue($class)); + $this->userManager = new UserManager($ef, "sha1", $c, $c, $this->dm, self::USERTYPE); + } + + public function testDeleteUser() + { + $user = new DummyUser(); + $this->dm->expects($this->once())->method('remove')->with($this->equalTo($user)); + $this->dm->expects($this->once())->method('flush'); + + $this->userManager->deleteUser($user); + } + + public function testGetClass() + { + $this->assertEquals(self::USERTYPE, $this->userManager->getClass()); + } + + public function testFindUserBy() + { + $crit = array("foo" => "bar"); + $this->repository->expects($this->once())->method('findBy')->with($this->equalTo($crit))->will($this->returnValue(array())); + + $this->userManager->findUserBy($crit); + } + + public function testFindUsers() + { + $this->repository->expects($this->once())->method('findAll')->will($this->returnValue(array())); + + $this->userManager->findUsers(); + } + + public function testUpdateUser() + { + $user = new DummyUser(); + $this->dm->expects($this->once())->method('persist')->with($this->equalTo($user)); + $this->dm->expects($this->once())->method('flush'); + + $this->userManager->updateUser($user); + } +} + +class DummyUser extends \FOS\UserBundle\Document\User +{ + +} \ No newline at end of file diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/DependencyInjection/Compiler/SecurityEncoderFactoryPassTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/DependencyInjection/Compiler/SecurityEncoderFactoryPassTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\DependencyInjection\Compiler; + +use FOS\UserBundle\DependencyInjection\Compiler\SecurityEncoderFactoryPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; + +class SecurityEncoderFactoryPassTest extends \PHPUnit_Framework_TestCase +{ + private $container; + private $pass; + + public function setUp() + { + $this->container = new ContainerBuilder(); + $this->pass = new SecurityEncoderFactoryPass(); + } + + public function testShouldComposeAlias() + { + $this->container->setDefinition('security.encoder_factory.real', new Definition()); + $this->container->setAlias('security.encoder_factory', 'security.encoder_factory.real'); + + $this->pass->process($this->container); + + $this->assertServiceHasAlias('security.encoder_factory.real', 'fos_user.encoder_factory.parent'); + $this->assertFalse($this->container->getAlias('fos_user.encoder_factory.parent')->isPublic()); + $this->assertServiceHasAlias('fos_user.encoder_factory', 'security.encoder_factory'); + } + + public function testShouldComposeDefinition() + { + $this->container->setDefinition('security.encoder_factory', $originalDefinition = new Definition()); + + $this->pass->process($this->container); + + $newDefinition = $this->container->getDefinition('fos_user.encoder_factory.parent'); + $this->assertFalse($newDefinition->isPublic()); + $this->assertSame($originalDefinition, $newDefinition); + + $this->assertServiceHasAlias('fos_user.encoder_factory', 'security.encoder_factory'); + } + + private function assertServiceHasAlias($serviceId, $aliasId) + { + $this->assertEquals($serviceId, (string) $this->container->getAlias($aliasId), sprintf('Service "%s" has alias "%s"', $serviceId, $aliasId)); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/DependencyInjection/FOSUserExtensionTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/DependencyInjection/FOSUserExtensionTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,426 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\DependencyInjection; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use FOS\UserBundle\DependencyInjection\FOSUserExtension; +use Symfony\Component\Yaml\Parser; + +class FOSUserExtensionTest extends \PHPUnit_Framework_TestCase +{ + protected $configuration; + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testUserLoadThrowsExceptionUnlessDatabaseDriverSet() + { + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + unset($config['db_driver']); + $loader->load(array($config), new ContainerBuilder()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testUserLoadThrowsExceptionUnlessDatabaseDriverIsValid() + { + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $config['db_driver'] = 'foo'; + $loader->load(array($config), new ContainerBuilder()); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testUserLoadThrowsExceptionUnlessFirewallNameSet() + { + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + unset($config['firewall_name']); + $loader->load(array($config), new ContainerBuilder()); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testUserLoadThrowsExceptionUnlessGroupModelClassSet() + { + $loader = new FOSUserExtension(); + $config = $this->getFullConfig(); + unset($config['group']['group_class']); + $loader->load(array($config), new ContainerBuilder()); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testUserLoadThrowsExceptionUnlessUserModelClassSet() + { + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + unset($config['user_class']); + $loader->load(array($config), new ContainerBuilder()); + } + + public function testDisableRegistration() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $config['registration'] = false; + $loader->load(array($config), $this->configuration); + $this->assertNotHasDefinition('fos_user.registration.form'); + } + + public function testDisableResetting() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $config['resetting'] = false; + $loader->load(array($config), $this->configuration); + $this->assertNotHasDefinition('fos_user.resetting.form'); + } + + public function testDisableProfile() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $config['profile'] = false; + $loader->load(array($config), $this->configuration); + $this->assertNotHasDefinition('fos_user.profile.form'); + } + + public function testDisableChangePassword() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $config['change_password'] = false; + $loader->load(array($config), $this->configuration); + $this->assertNotHasDefinition('fos_user.change_password.form'); + } + + public function testUserLoadModelClassWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter('Acme\MyBundle\Document\User', 'fos_user.model.user.class'); + } + + public function testUserLoadModelClass() + { + $this->createFullConfiguration(); + + $this->assertParameter('Acme\MyBundle\Entity\User', 'fos_user.model.user.class'); + } + + public function testUserLoadManagerClassWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter(null, 'fos_user.model_manager_name'); + $this->assertAlias('fos_user.user_manager.default', 'fos_user.user_manager'); + $this->assertNotHasDefinition('fos_user.group_manager'); + } + + public function testUserLoadManagerClass() + { + $this->createFullConfiguration(); + + $this->assertParameter('custom', 'fos_user.model_manager_name'); + $this->assertAlias('acme_my.user_manager', 'fos_user.user_manager'); + $this->assertAlias('fos_user.group_manager.default', 'fos_user.group_manager'); + } + + public function testUserLoadFormClassWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter('fos_user_profile', 'fos_user.profile.form.type'); + $this->assertParameter('fos_user_registration', 'fos_user.registration.form.type'); + $this->assertParameter('fos_user_change_password', 'fos_user.change_password.form.type'); + $this->assertParameter('fos_user_resetting', 'fos_user.resetting.form.type'); + } + + public function testUserLoadFormClass() + { + $this->createFullConfiguration(); + + $this->assertParameter('acme_my_profile', 'fos_user.profile.form.type'); + $this->assertParameter('acme_my_registration', 'fos_user.registration.form.type'); + $this->assertParameter('acme_my_group', 'fos_user.group.form.type'); + $this->assertParameter('acme_my_change_password', 'fos_user.change_password.form.type'); + $this->assertParameter('acme_my_resetting', 'fos_user.resetting.form.type'); + } + + public function testUserLoadFormNameWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter('fos_user_profile_form', 'fos_user.profile.form.name'); + $this->assertParameter('fos_user_registration_form', 'fos_user.registration.form.name'); + $this->assertParameter('fos_user_change_password_form', 'fos_user.change_password.form.name'); + $this->assertParameter('fos_user_resetting_form', 'fos_user.resetting.form.name'); + } + + public function testUserLoadFormName() + { + $this->createFullConfiguration(); + + $this->assertParameter('acme_profile_form', 'fos_user.profile.form.name'); + $this->assertParameter('acme_registration_form', 'fos_user.registration.form.name'); + $this->assertParameter('acme_group_form', 'fos_user.group.form.name'); + $this->assertParameter('acme_change_password_form', 'fos_user.change_password.form.name'); + $this->assertParameter('acme_resetting_form', 'fos_user.resetting.form.name'); + } + + public function testUserLoadFormServiceWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertHasDefinition('fos_user.profile.form'); + $this->assertHasDefinition('fos_user.registration.form'); + $this->assertNotHasDefinition('fos_user.group.form'); + $this->assertHasDefinition('fos_user.change_password.form'); + $this->assertHasDefinition('fos_user.resetting.form'); + } + + public function testUserLoadFormService() + { + $this->createFullConfiguration(); + + $this->assertHasDefinition('fos_user.profile.form'); + $this->assertHasDefinition('fos_user.registration.form'); + $this->assertHasDefinition('fos_user.group.form'); + $this->assertHasDefinition('fos_user.change_password.form'); + $this->assertHasDefinition('fos_user.resetting.form'); + } + + public function testUserLoadConfirmationEmailWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter(false, 'fos_user.registration.confirmation.enabled'); + $this->assertParameter(array('webmaster@example.com' => 'webmaster'), 'fos_user.registration.confirmation.from_email'); + $this->assertParameter('FOSUserBundle:Registration:email.txt.twig', 'fos_user.registration.confirmation.template'); + $this->assertParameter('FOSUserBundle:Resetting:email.txt.twig', 'fos_user.resetting.email.template'); + $this->assertParameter(array('webmaster@example.com' => 'webmaster'), 'fos_user.resetting.email.from_email'); + $this->assertParameter(86400, 'fos_user.resetting.token_ttl'); + } + + public function testUserLoadConfirmationEmail() + { + $this->createFullConfiguration(); + + $this->assertParameter(true, 'fos_user.registration.confirmation.enabled'); + $this->assertParameter(array('register@acme.org' => 'Acme Corp'), 'fos_user.registration.confirmation.from_email'); + $this->assertParameter('AcmeMyBundle:Registration:mail.txt.twig', 'fos_user.registration.confirmation.template'); + $this->assertParameter('AcmeMyBundle:Resetting:mail.txt.twig', 'fos_user.resetting.email.template'); + $this->assertParameter(array('reset@acme.org' => 'Acme Corp'), 'fos_user.resetting.email.from_email'); + $this->assertParameter(1800, 'fos_user.resetting.token_ttl'); + } + + public function testUserLoadTemplateConfigWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter('twig', 'fos_user.template.engine'); + $this->assertParameter('FOSUserBundle::form.html.twig', 'fos_user.template.theme'); + } + + public function testUserLoadTemplateConfig() + { + $this->createFullConfiguration(); + + $this->assertParameter('php', 'fos_user.template.engine'); + $this->assertParameter('AcmeMyBundle:Form:theme.html.twig', 'fos_user.template.theme'); + } + + public function testUserLoadEncoderConfigWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertParameter('sha512', 'fos_user.encoder.algorithm'); + $this->assertParameter(false, 'fos_user.encoder.encode_as_base64'); + $this->assertParameter(1, 'fos_user.encoder.iterations'); + } + + public function testUserLoadEncoderConfig() + { + $this->createFullConfiguration(); + + $this->assertParameter('sha1', 'fos_user.encoder.algorithm'); + $this->assertParameter(true, 'fos_user.encoder.encode_as_base64'); + $this->assertParameter(3, 'fos_user.encoder.iterations'); + } + + public function testUserLoadUtilServiceWithDefaults() + { + $this->createEmptyConfiguration(); + + $this->assertAlias('fos_user.mailer.default', 'fos_user.mailer'); + $this->assertAlias('fos_user.util.email_canonicalizer.default', 'fos_user.util.email_canonicalizer'); + $this->assertAlias('fos_user.util.username_canonicalizer.default', 'fos_user.util.username_canonicalizer'); + } + + public function testUserLoadUtilService() + { + $this->createFullConfiguration(); + + $this->assertAlias('acme_my.mailer', 'fos_user.mailer'); + $this->assertAlias('acme_my.email_canonicalizer', 'fos_user.util.email_canonicalizer'); + $this->assertAlias('acme_my.username_canonicalizer', 'fos_user.util.username_canonicalizer'); + } + + /** + * @return ContainerBuilder + */ + protected function createEmptyConfiguration() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getEmptyConfig(); + $loader->load(array($config), $this->configuration); + $this->assertTrue($this->configuration instanceof ContainerBuilder); + } + + /** + * @return ContainerBuilder + */ + protected function createFullConfiguration() + { + $this->configuration = new ContainerBuilder(); + $loader = new FOSUserExtension(); + $config = $this->getFullConfig(); + $loader->load(array($config), $this->configuration); + $this->assertTrue($this->configuration instanceof ContainerBuilder); + } + + /** + * getEmptyConfig + * + * @return array + */ + protected function getEmptyConfig() + { + $yaml = <<parse($yaml); + } + + protected function getFullConfig() + { + $yaml = <<parse($yaml); + } + + private function assertAlias($value, $key) + { + $this->assertEquals($value, (string) $this->configuration->getAlias($key), sprintf('%s alias is correct', $key)); + } + + private function assertParameter($value, $key) + { + $this->assertEquals($value, $this->configuration->getParameter($key), sprintf('%s parameter is correct', $key)); + } + + private function assertHasDefinition($id) + { + $this->assertTrue(($this->configuration->hasDefinition($id) ?: $this->configuration->hasAlias($id))); + } + + private function assertNotHasDefinition($id) + { + $this->assertFalse(($this->configuration->hasDefinition($id) ?: $this->configuration->hasAlias($id))); + } + + protected function tearDown() + { + unset($this->configuration); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Document/DocumentUserManagerTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Document/DocumentUserManagerTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Document; + +class DocumentUserManagerTest extends \PHPUnit_Framework_TestCase +{ + protected $userManager; + + public function testFindUserByUsername() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('usernameCanonical' => 'jack'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeUsername') + ->with($this->equalTo('jack')) + ->will($this->returnValue('jack')); + + $this->userManager->findUserByUsername('jack'); + } + + public function testFindUserByUsernameLowercasesTheUsername() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('usernameCanonical' => 'jack'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeUsername') + ->with($this->equalTo('JaCk')) + ->will($this->returnValue('jack')); + + $this->userManager->findUserByUsername('JaCk'); + } + + public function testFindUserByEmail() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('emailCanonical' => 'jack@email.org'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeEmail') + ->with($this->equalTo('jack@email.org')) + ->will($this->returnValue('jack@email.org')); + + $this->userManager->findUserByEmail('jack@email.org'); + } + + public function testFindUserByEmailLowercasesTheEmail() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('emailCanonical' => 'jack@email.org'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeEmail') + ->with($this->equalTo('JaCk@EmAiL.oRg')) + ->will($this->returnValue('jack@email.org')); + + $this->userManager->findUserByEmail('JaCk@EmAiL.oRg'); + } + + public function testFindUserByUsernameOrEmailWithUsername() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('usernameCanonical' => 'jack'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeUsername') + ->with($this->equalTo('JaCk')) + ->will($this->returnValue('jack')); + + $this->userManager->findUserByUsernameOrEmail('JaCk'); + } + + public function testFindUserByUsernameOrEmailWithEmail() + { + $this->userManager->expects($this->once()) + ->method('findUserBy') + ->with($this->equalTo(array('emailCanonical' => 'jack@email.org'))); + $this->userManager->expects($this->once()) + ->method('canonicalizeEmail') + ->with($this->equalTo('JaCk@EmAiL.oRg')) + ->will($this->returnValue('jack@email.org')); + + $this->userManager->findUserByUsernameOrEmail('JaCk@EmAiL.oRg'); + } + + public function testLoadUserByUsernameWithExistingUser() + { + $userMock = $this->getMock('FOS\UserBundle\Document\User', array(), array('sha1')); + + $manager = $this->getMockBuilder('FOS\UserBundle\Document\UserManager') + ->disableOriginalConstructor() + ->setMethods(array('findUserByUsername')) + ->getMock(); + + $manager->expects($this->once()) + ->method('findUserByUsername') + ->with($this->equalTo('jack')) + ->will($this->returnValue($userMock)); + + $manager->loadUserByUsername('jack'); + } + + /** + * @expectedException Symfony\Component\Security\Core\Exception\UsernameNotFoundException + */ + public function testLoadUserByUsernameWithMissingUser() + { + $manager = $this->getMockBuilder('FOS\UserBundle\Document\UserManager') + ->disableOriginalConstructor() + ->setMethods(array('findUserByUsername')) + ->getMock(); + + $manager->expects($this->once()) + ->method('findUserByUsername') + ->with($this->equalTo('jack')) + ->will($this->returnValue(null)); + + $manager->loadUserByUsername('jack'); + } + + protected function setUp() + { + if (!class_exists('\Doctrine\ODM\MongoDB\DocumentManager')) { + $this->markTestSkipped('No ODM installed'); + } + + $this->userManager = $this->getManagerMock(); + } + + protected function tearDown() + { + unset($this->userManager); + } + + protected function getManagerMock() + { + return $this->getMockBuilder('FOS\UserBundle\Document\UserManager') + ->disableOriginalConstructor() + ->setMethods(array('findUserBy', 'canonicalizeUsername', 'canonicalizeEmail')) + ->getMock(); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Model/UserManagerTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Model/UserManagerTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Model; + +class UserManagerTest extends \PHPUnit_Framework_TestCase +{ + private $manager; + private $encoderFactory; + private $algorithm; + private $usernameCanonicalizer; + private $emailCanonicalizer; + + protected function setUp() + { + $this->encoderFactory = $this->getMockEncoderFactory(); + $this->algorithm = 'sha512'; + $this->usernameCanonicalizer = $this->getMockCanonicalizer(); + $this->emailCanonicalizer = $this->getMockCanonicalizer(); + + $this->manager = $this->getUserManager(array( + $this->encoderFactory, + $this->algorithm, + $this->usernameCanonicalizer, + $this->emailCanonicalizer, + )); + } + + public function testUpdateCanonicalFields() + { + $user = $this->getUser(); + $user->setUsername('Username'); + $user->setEmail('User@Example.com'); + + $this->usernameCanonicalizer->expects($this->once()) + ->method('canonicalize') + ->with('Username') + ->will($this->returnCallback('strtolower')); + + $this->emailCanonicalizer->expects($this->once()) + ->method('canonicalize') + ->with('User@Example.com') + ->will($this->returnCallback('strtolower')); + + $this->manager->updateCanonicalFields($user); + $this->assertEquals('username', $user->getUsernameCanonical()); + $this->assertEquals('user@example.com', $user->getEmailCanonical()); + } + + public function testUpdatePassword() + { + $encoder = $this->getMockPasswordEncoder(); + $user = $this->getUser(); + $user->setPlainPassword('password'); + + $this->encoderFactory->expects($this->once()) + ->method('getEncoder') + ->will($this->returnValue($encoder)); + + $encoder->expects($this->once()) + ->method('encodePassword') + ->with('password', $user->getSalt()) + ->will($this->returnValue('encodedPassword')); + + $this->manager->updatePassword($user); + $this->assertEquals($this->algorithm, $user->getAlgorithm(), '->updatePassword() sets algorithm'); + $this->assertEquals('encodedPassword', $user->getPassword(), '->updatePassword() sets encoded password'); + $this->assertNull($user->getPlainPassword(), '->updatePassword() erases credentials'); + } + + private function getMockCanonicalizer() + { + return $this->getMock('FOS\UserBundle\Util\CanonicalizerInterface'); + } + + private function getMockEncoderFactory() + { + return $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface'); + } + + private function getMockPasswordEncoder() + { + return $this->getMock('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface'); + } + + private function getUser() + { + return $this->getMockBuilder('FOS\UserBundle\Model\User') + ->getMockForAbstractClass(); + } + + private function getUserManager(array $args) + { + return $this->getMockBuilder('FOS\UserBundle\Model\UserManager') + ->setConstructorArgs($args) + ->getMockForAbstractClass(); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Model/UserTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Model/UserTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,99 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Model; + +use FOS\UserBundle\Model\User; + +class UserTest extends \PHPUnit_Framework_TestCase +{ + public function testUsername() + { + $user = $this->getUser(); + $this->assertNull($user->getUsername()); + + $user->setUsername('tony'); + $this->assertEquals('tony', $user->getUsername()); + } + + public function testEmail() + { + $user = $this->getUser(); + $this->assertNull($user->getEmail()); + + $user->setEmail('tony@mail.org'); + $this->assertEquals('tony@mail.org', $user->getEmail()); + } + + public function testIsPasswordRequestNonExpired() + { + $user = $this->getUser(); + $passwordRequestedAt = new \DateTime('-10 seconds'); + + $user->setPasswordRequestedAt($passwordRequestedAt); + + $this->assertSame($passwordRequestedAt, $user->getPasswordRequestedAt()); + $this->assertTrue($user->isPasswordRequestNonExpired(15)); + $this->assertFalse($user->isPasswordRequestNonExpired(5)); + } + + public function testTrueHasRole() + { + $user = $this->getUser(); + $defaultrole = User::ROLE_DEFAULT; + $newrole = 'ROLE_X'; + $this->assertTrue($user->hasRole($defaultrole)); + $user->addRole($defaultrole); + $this->assertTrue($user->hasRole($defaultrole)); + $user->addRole($newrole); + $this->assertTrue($user->hasRole($newrole)); + } + + public function testFalseHasRole() + { + $user = $this->getUser(); + $newrole = 'ROLE_X'; + $this->assertFalse($user->hasRole($newrole)); + $user->addRole($newrole); + $this->assertTrue($user->hasRole($newrole)); + } + + public function testForEqualUsers() + { + $user1 = $this->getMockBuilder('FOS\UserBundle\Model\User')->setMethods(array('getSalt'))->getMock(); + $user2 = $this->getMockBuilder('FOS\UserBundle\Model\User')->setMethods(array('getSalt'))->getMock(); + $user3 = $this->getMockBuilder('FOS\UserBundle\Model\User')->setMethods(array('getSalt'))->getMock(); + + $salt1 = $salt3 = 'xxxx'; + $salt2 = 'yyyy'; + + $user2->expects($this->once()) + ->method('getSalt') + ->will($this->returnValue($salt2)); + + $user1->expects($this->any()) + ->method('getSalt') + ->will($this->returnValue($salt1)); + + $user3->expects($this->once()) + ->method('getSalt') + ->will($this->returnValue($salt3)); + + $this->assertFalse($user1->equals($user2)); + $this->assertTrue($user1->equals($user1)); + $this->assertTrue($user1->equals($user3)); + } + + protected function getUser() + { + return $this->getMockForAbstractClass('FOS\UserBundle\Model\User'); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Security/Encoder/EncoderFactoryTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Security/Encoder/EncoderFactoryTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Security\Encoder; + +use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; +use FOS\UserBundle\Security\Encoder\EncoderFactory; + +class EncoderFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers FOS\UserBundle\Security\Encoder\EncoderFactory::getEncoder + * @covers FOS\UserBundle\Security\Encoder\EncoderFactory::createEncoder + */ + public function testGetEncoderWithUserAccount() + { + $factory = new EncoderFactory( + 'Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder', + false, + 1, + $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface') + ); + + $userAccount = $this->getMock('FOS\UserBundle\Model\UserInterface'); + + $userAccount->expects($this->once()) + ->method('getAlgorithm') + ->will($this->returnValue('sha512')); + + $encoder = $factory->getEncoder($userAccount); + + $expectedEncoder = new MessageDigestPasswordEncoder('sha512', false, 1); + + $this->assertEquals($expectedEncoder->encodePassword('foo', 'bar'), $encoder->encodePassword('foo', 'bar')); + } + + public function testGetEncoderWithGenericAccount() + { + $genericFactory = $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface'); + $encoder = $this->getMock('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface'); + + $genericFactory + ->expects($this->once()) + ->method('getEncoder') + ->will($this->returnValue($encoder)) + ; + + $factory = new EncoderFactory(null , false, 1, $genericFactory); + + $this->assertSame($encoder, $factory->getEncoder($this->getMock('Symfony\Component\Security\Core\User\UserInterface'))); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/TestUser.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/TestUser.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests; + +use FOS\UserBundle\Model\User; + +class TestUser extends User +{ + public function setId($id) + { + $this->id = $id; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Util/UserManipulatorTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Util/UserManipulatorTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,286 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Util; + +use FOS\UserBundle\Util\UserManipulator; +use FOS\UserBundle\Tests\TestUser; +use Symfony\Component\Security\Acl\Domain\Acl; +use Symfony\Component\Security\Acl\Domain\ObjectIdentity; +use Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy; + +class UserManipulatorTest extends \PHPUnit_Framework_TestCase +{ + public function testCreate() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $user = new TestUser(); + + $username = 'test_username'; + $password = 'test_password'; + $email = 'test@email.org'; + $active = true; // it is enabled + $superadmin = false; + + $userManagerMock->expects($this->once()) + ->method('createUser') + ->will($this->returnValue($user)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->create($username, $password, $email, $active, $superadmin); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals($password, $user->getPlainPassword()); + $this->assertEquals($email, $user->getEmail()); + $this->assertEquals($active, $user->isEnabled()); + $this->assertEquals($superadmin, $user->isSuperAdmin()); + } + + public function testActivateWithValidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $username = 'test_username'; + + $user = new TestUser(); + $user->setUsername($username); + $user->setEnabled(false); + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue($user)) + ->with($this->equalTo($username)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->activate($username); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals(true, $user->isEnabled()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testActivateWithInvalidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $invalidusername = 'invalid_username'; + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue(null)) + ->with($this->equalTo($invalidusername)); + + $userManagerMock->expects($this->never()) + ->method('updateUser'); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->activate($invalidusername); + } + + public function testDeactivateWithValidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $username = 'test_username'; + + $user = new TestUser(); + $user->setUsername($username); + $user->setEnabled(true); + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue($user)) + ->with($this->equalTo($username)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->deactivate($username); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals(false, $user->isEnabled()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testDeactivateWithInvalidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $invalidusername = 'invalid_username'; + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue(null)) + ->with($this->equalTo($invalidusername)); + + $userManagerMock->expects($this->never()) + ->method('updateUser'); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->deactivate($invalidusername); + } + + public function testPromoteWithValidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $username = 'test_username'; + + $user = new TestUser(); + $user->setUsername($username); + $user->setSuperAdmin(false); + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue($user)) + ->with($this->equalTo($username)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->promote($username); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals(true, $user->isSuperAdmin()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testPromoteWithInvalidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $invalidusername = 'invalid_username'; + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue(null)) + ->with($this->equalTo($invalidusername)); + + $userManagerMock->expects($this->never()) + ->method('updateUser'); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->promote($invalidusername); + } + + public function testDemoteWithValidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $username = 'test_username'; + + $user = new TestUser(); + $user->setUsername($username); + $user->setSuperAdmin(true); + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue($user)) + ->with($this->equalTo($username)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->demote($username); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals(false, $user->isSuperAdmin()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testDemoteWithInvalidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $invalidusername = 'invalid_username'; + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue(null)) + ->with($this->equalTo($invalidusername)); + + $userManagerMock->expects($this->never()) + ->method('updateUser'); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->demote($invalidusername); + } + + public function testChangePasswordWithValidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + + $user = new TestUser(); + $username = 'test_username'; + $password = 'test_password'; + $oldpassword = 'old_password'; + + $user->setUsername($username); + $user->setPlainPassword($oldpassword); + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue($user)) + ->with($this->equalTo($username)); + + $userManagerMock->expects($this->once()) + ->method('updateUser') + ->will($this->returnValue($user)) + ->with($this->isInstanceOf('FOS\UserBundle\Tests\TestUser')); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->changePassword($username, $password); + + $this->assertEquals($username, $user->getUsername()); + $this->assertEquals($password, $user->getPlainPassword()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testChangePasswordWithInvalidUsername() + { + $userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + + $invalidusername = 'invalid_username'; + $password = 'test_password'; + + $userManagerMock->expects($this->once()) + ->method('findUserByUsername') + ->will($this->returnValue(null)) + ->with($this->equalTo($invalidusername)); + + $userManagerMock->expects($this->never()) + ->method('updateUser'); + + $manipulator = new UserManipulator($userManagerMock); + $manipulator->changePassword($invalidusername, $password); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Validation/PasswordValidatorTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Validation/PasswordValidatorTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Validation; + +use FOS\UserBundle\Validator\PasswordValidator; +use FOS\UserBundle\Validator\Password; +use FOS\UserBundle\Form\Model\ChangePassword; + +class PasswordValidatorTest extends \PHPUnit_Framework_TestCase +{ + private $validator; + private $constraint; + private $encoderFactory; + private $changePasswordObject; + private $encoder; + + public function setUp() + { + $this->constraint = new Password(); + $this->constraint->passwordProperty = 'current'; + $this->constraint->userProperty = 'user'; + + $this->changePasswordObject = new ChangePassword($this->getMock('FOS\UserBundle\Model\UserInterface')); + $this->encoderFactory = $this->getMock('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface'); + $this->encoder = $this->getMock('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface'); + + $this->validator = new PasswordValidator(); + $this->validator->setEncoderFactory($this->encoderFactory); + } + + /** + * @expectedException \RuntimeException + */ + public function testExceptionForNonObject() + { + $this->validator->isValid('propertyValue', $this->constraint); + } + + public function testFalseOnInvalidPassword() + { + $this->encoderFactory->expects($this->once()) + ->method('getEncoder') + ->will($this->returnValue($this->encoder)); + + $this->encoder->expects($this->once()) + ->method('isPasswordValid') + ->will($this->returnValue(false)); + + $this->assertFalse($this->validator->isValid($this->changePasswordObject, $this->constraint)); + } + + public function testTrueOnValidPassword() + { + $this->encoderFactory->expects($this->once()) + ->method('getEncoder') + ->will($this->returnValue($this->encoder)); + + $this->encoder->expects($this->once()) + ->method('isPasswordValid') + ->will($this->returnValue(true)); + + $this->assertTrue($this->validator->isValid($this->changePasswordObject, $this->constraint)); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/Validation/UniqueValidatorTest.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/Validation/UniqueValidatorTest.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Tests\Validation; + +use FOS\UserBundle\Validator\UniqueValidator; +use FOS\UserBundle\Validator\Unique; + +class UniqueValidatorTest extends \PHPUnit_Framework_TestCase +{ + private $validator; + private $userManagerMock; + private $constraint; + private $user; + + public function setUp() + { + $this->userManagerMock = $this->getMock('FOS\UserBundle\Model\UserManagerInterface'); + $this->constraint = new Unique(); + $this->validator = new UniqueValidator($this->userManagerMock); + $this->user = $this->getMock('FOS\UserBundle\Model\UserInterface'); + } + + public function testFalseOnDuplicateUserProperty() + { + $this->userManagerMock->expects($this->once()) + ->method('validateUnique') + ->will($this->returnValue(false)) + ->with($this->equalTo($this->user), $this->equalTo($this->constraint)); + + $this->assertFalse($this->validator->isValid($this->user, $this->constraint)); + } + + public function testTrueOnUniqueUserProperty() + { + $this->userManagerMock->expects($this->once()) + ->method('validateUnique') + ->will($this->returnValue(true)) + ->with($this->equalTo($this->user), $this->equalTo($this->constraint)); + + $this->assertTrue($this->validator->isValid($this->user, $this->constraint)); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/autoload.php.dist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/autoload.php.dist Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,18 @@ +registerNamespaces(array( + 'Symfony' => array($vendorDir.'/symfony/src', $vendorDir.'/bundles'), + 'FOS' => $vendorDir.'/bundles', + 'Doctrine\\Common' => $vendorDir.'/doctrine-common/lib', + 'Doctrine\\DBAL' => $vendorDir.'/doctrine-dbal/lib', + 'Doctrine\\ODM\\MongodB' => $vendorDir.'/doctrine-mongodb-odm/lib', + 'Doctrine\\MongodB' => $vendorDir.'/doctrine-mongodb/lib', + 'Doctrine' => $vendorDir.'/doctrine/lib', +)); +$loader->register(); diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Tests/bootstrap.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Tests/bootstrap.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (file_exists($file = __DIR__.'/autoload.php')) { + require_once $file; +} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) { + require_once $file; +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/UPDATE.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/UPDATE.md Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,32 @@ +How to update your bundle ? +=========================== + +This document explains how to upgrade from one FOSUSerBundle version to +the next one. It only discusses changes that need to be done when using +the "public" API of the bundle. If you "hack" the core, you should probably +follow the timeline closely anyway. + +* The methods relative to the groups have been removed from `FOS\UserBundle\Model\UserInterface` + and a new `FOS\UserBundle\Model\GroupableInterface` has been added (implemented + by `FOS\UserBundle\Model\User`). + +* The User class of the bundle does not contain the timestampable fields anymore + as they were not used by the bundle. + +* The `fos:user:changePassword` command has been renamed to `fos:user:change-password`. + +* The way to configure the forms has been refactored to give more flexibility: + + * The configuration of the type now accepts the name of the type. You can + register your own type by creating a tagged service in the container: + + + + * The configuration of the handler now accepts a service id. + +* The form classes have been moved to subnamespaces to keep them organized. + +* The ACL implementation using JMSSecurityExtraBundle which was broken + since Symfony beta2 has been removed. + +* The Twig block has been renamed from `content` to `fos_user_content`. diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Util/Canonicalizer.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Util/Canonicalizer.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Util; + +class Canonicalizer implements CanonicalizerInterface +{ + public function canonicalize($string) + { + return mb_convert_case($string, MB_CASE_LOWER, mb_detect_encoding($string)); + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Util/CanonicalizerInterface.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Util/CanonicalizerInterface.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Util; + +interface CanonicalizerInterface +{ + function canonicalize($string); +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Util/UserManipulator.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Util/UserManipulator.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Util; + +use FOS\UserBundle\Model\UserManagerInterface; + +/** + * Executes some manipulations on the users + * + * @author Christophe Coevoet + * @author Luis Cordova + */ +class UserManipulator +{ + /** + * User manager + * + * @var UserManagerInterface + */ + private $userManager; + + public function __construct(UserManagerInterface $userManager) + { + $this->userManager = $userManager; + } + + /** + * Creates a user and returns it. + * + * @param string $username + * @param string $password + * @param string $email + * @param Boolean $active + * @param Boolean $superadmin + * @return \FOS\UserBundle\Model\UserInterface + */ + public function create($username, $password, $email, $active, $superadmin) + { + $user = $this->userManager->createUser(); + $user->setUsername($username); + $user->setEmail($email); + $user->setPlainPassword($password); + $user->setEnabled((Boolean)$active); + $user->setSuperAdmin((Boolean)$superadmin); + $this->userManager->updateUser($user); + + return $user; + } + + /** + * Activates the given user. + * + * @param string $username + */ + public function activate($username) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + $user->setEnabled(true); + $this->userManager->updateUser($user); + } + + /** + * Deactivates the given user. + * + * @param string $username + */ + public function deactivate($username) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + $user->setEnabled(false); + $this->userManager->updateUser($user); + } + + /** + * Changes the password for the given user. + * + * @param string $username + * @param string $password + */ + public function changePassword($username, $password) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + $user->setPlainPassword($password); + $this->userManager->updateUser($user); + } + + /** + * Promotes the given user. + * + * @param string $username + */ + public function promote($username) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + $user->setSuperAdmin(true); + $this->userManager->updateUser($user); + } + + /** + * Demotes the given user. + * + * @param string $username + */ + public function demote($username) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + $user->setSuperAdmin(false); + $this->userManager->updateUser($user); + } + + /** + * Adds role to the given user. + * + * @param string $username + * @param string $role + * @return Boolean true if role was added, false if user already had the role + */ + public function addRole($username, $role) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + if ($user->hasRole($role)) { + return false; + } + $user->addRole($role); + $this->userManager->updateUser($user); + + return true; + } + /** + * Removes role from the given user. + * + * @param string $username + * @param string $role + * @return Boolean true if role was removed, false if user didn't have the role + */ + public function removeRole($username, $role) + { + $user = $this->userManager->findUserByUsername($username); + + if (!$user) { + throw new \InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username)); + } + if (!$user->hasRole($role)) { + return false; + } + $user->removeRole($role); + $this->userManager->updateUser($user); + + return true; + } + +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Validator/Password.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Validator/Password.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Validator; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + */ +class Password extends Constraint +{ + public $message = 'The entered password is invalid.'; + public $passwordProperty; + public $userProperty; + + public function requiredOptions() + { + return array('passwordProperty'); + } + + public function validatedBy() + { + return 'fos_user.validator.password'; + } + + /** + * {@inheritDoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Validator/PasswordValidator.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Validator/PasswordValidator.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Validator; + +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; + +class PasswordValidator extends ConstraintValidator +{ + protected $encoderFactory; + + public function setEncoderFactory(EncoderFactoryInterface $factory) + { + $this->encoderFactory = $factory; + } + + public function isValid($object, Constraint $constraint) + { + if (!is_object($object)) { + throw new \RuntimeException('This is a class constraint.'); + } + $raw = $object->{$constraint->passwordProperty}; + $user = null === $constraint->userProperty ? $object : $object->{$constraint->userProperty}; + $encoder = $this->encoderFactory->getEncoder($user); + if (!$encoder->isPasswordValid($user->getPassword(), $raw, $user->getSalt())) { + $this->setMessage($constraint->message); + + return false; + } + + return true; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Validator/Unique.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Validator/Unique.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Validator; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + */ +class Unique extends Constraint +{ + public $message = 'The value for "%property%" already exists.'; + public $property; + + public function defaultOption() + { + return 'property'; + } + + public function requiredOptions() + { + return array('property'); + } + + public function validatedBy() + { + return 'fos_user.validator.unique'; + } + + /** + * {@inheritDoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/Validator/UniqueValidator.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/Validator/UniqueValidator.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\UserBundle\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use FOS\UserBundle\Model\UserManagerInterface; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * UniqueValidator + */ +class UniqueValidator extends ConstraintValidator +{ + /** + * @var UserManagerInterface + */ + protected $userManager; + + /** + * Constructor + * + * @param UserManagerInterface $userManager + */ + public function __construct(UserManagerInterface $userManager) + { + $this->userManager = $userManager; + } + + /** + * Sets the user manager + * + * @param UserManagerInterface $userManager + */ + public function setUserManager(UserManagerInterface $userManager) + { + $this->userManager = $userManager; + } + + /** + * Gets the user manager + * + * @return UserManagerInterface + */ + public function getUserManager() + { + return $this->userManager; + } + + /** + * Indicates whether the constraint is valid + * + * @param Entity $value + * @param Constraint $constraint + */ + public function isValid($value, Constraint $constraint) + { + if (!$this->getUserManager()->validateUnique($value, $constraint)) { + $this->setMessage($constraint->message, array( + '%property%' => $constraint->property + )); + return false; + } + + return true; + } +} diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/phpunit.xml.dist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/phpunit.xml.dist Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,25 @@ + + + + + + + ./Tests + + + + + + ./ + + ./Resources + ./Tests + + + +