Questions around the Aimeos bundle for the Symfony framework
Forum rules: Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#1461 by aimeos
26 Jan 2015, 15:36
Hi Garret

Sure, every contribution is welcome!
#1462 by garwat82
30 Jan 2015, 14:17
Hey

The necessary changes have been committed and as far as I can see, the tests for the core and the Symfony adapter succeed now.
There's a pull request for the Symfony bundle as well and it may require some more attention because I've only added the FosUser entity and that's no used by default.

Regards,

Garret
#1464 by aimeos
30 Jan 2015, 18:19
Great! How does it work?
Maybe we can write some documentation for it.
#1465 by garwat82
30 Jan 2015, 19:47
I've used 2.0 branch of the FosUserBundle and I've added this to the require section of my composer.json:
Code: Select all"friendsofsymfony/user-bundle": "~2.0@dev"


In AppKernel::registerBundles() the bundle must be registered:
Code: Select allnew FOS\UserBundle\FOSUserBundle(),


The config.yml needs these settings and I've used the secure Bcrypt encryption:
Code: Select allfos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: aimeos_myaccount
    user_class: Aimeos\ShopBundle\Entity\FosUser

aimeos_shop:
    classes:
        customer:
            manager:
                name: FosUser
    mshop:
        customer:
            manager:
                password:
                    name: Bcrypt


The user bundle routes must also be included in the routing.yml:
Code: Select allfos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"


The security.yml is the most complex file:
Code: Select allsecurity:
    providers:
        aimeos_customer:
            entity: { class: AimeosShopBundle:FosUser, property: username }

    encoders:
        Aimeos\ShopBundle\Entity\FosUser: bcrypt

    firewalls:
        aimeos_myaccount:
            pattern: ^/
            form_login:
                provider: aimeos_customer
                csrf_provider: form.csrf_provider
            logout:       true
            anonymous:    true

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/myaccount, roles: ROLE_USER }


Hope this helps.