Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

[2.3] Remove Acme Demo bundle #818

Merged
merged 3 commits into from
Jun 11, 2015
Merged

Conversation

javiereguiluz
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

This removes the AcmeDemoBundle for Symfony Standard 2.3. I'm going to send another pull request for Symfony 2.6+.

@javiereguiluz javiereguiluz changed the title Remove Acme Demo bundle [2.3] Remove Acme Demo bundle Jun 5, 2015
@stof
Copy link
Member

stof commented Jun 11, 2015

Is the security config still working now that we don't have any firewall anymore except the one disabling security for the toolbar and assetic ?

@javiereguiluz
Copy link
Member Author

Thanks for your review. As you cleverly guessed, this security config file doesn't work:

security_problem

I've tried several configurations, but I cannot create "the minimal empty security configuration file". Any suggestion will be considered and appreciated.

@Pierstoval
Copy link
Contributor

Using this should work:

security:

    providers:
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt|error)|css|images|js)/
            security: false

        default:
            anonymous: ~

@javiereguiluz
Copy link
Member Author

@Pierstoval indeed it works. Thanks!

However, that file contents look strange. I'd like to either provide an empty security configuration (it looks impossible due to the limitations of the security component and/or bundle) or provide a useful and complete sample file. I don't know what to do.

@javiereguiluz
Copy link
Member Author

Maybe @weaverryan can also share his opinion about what would be best for newcomers.

@stof
Copy link
Member

stof commented Jun 11, 2015

looks good to me (except I would name the main firewall main rather than default, as it is not a default one)

@stof
Copy link
Member

stof commented Jun 11, 2015

and providing an empty configuration is indeed not possible. The SecurityBundle considers that you made a mistake if you enable it but don't configure the security layer (a firewall defined with security: false is not considered as having the security layer configured, which is true as it means that you don't want the security layer to be applied on this pattern).
And in any case, changing this behavior of SecurityBundle in patch releases looks wrong to me, so we need to live with it when configuring the SE for 2.3.

@Pierstoval
Copy link
Contributor

Same as @stof . I only made a copy/paste of the security.yml from a blank SF2.7 installation 😄

@javiereguiluz you may then add multiple comments explaining how the security works, with a link to the different parts of the docs. I remember an old version of the security.yml file with many comments, like this:

# you can read more about security in the related section of the documentation
# http://symfony.com/doc/current/book/security.html
security:

    # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext

    # http://symfony.com/doc/current/book/security.html#hierarchical-roles
    role_hierarchy:
        ROLE_ADMIN: ROLE_USER
        ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        in_memory: ~

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~

    # with these settings you can restrict or allow access for different parts
    # of your application based on roles, ip, host or methods
    # http://symfony.com/doc/current/book/security.html#security-book-access-control-matching-options
    access_control:
        # - { path: ^/admin, roles: [ROLE_ADMIN] }

Then you can remove anything "not useful" or "too complex" for newcomers, but IMO, we should keep everything in this example.
The access_control part is almost mandatory in creating a secured backend, and the encoders need to be overriden when using FOSUserBundle. Even though I think this part can be removed, it can also be useful.

@javiereguiluz
Copy link
Member Author

@Pierstoval I think we are mistaking some things. We cannot put a lot of help notes in the security.yml because this is not the Symfony Demo application. This is a blank Symfony application that people use to start coding their Symfony applications. That's why we should provide the application as "clean" and "untouched" as possible.

@Pierstoval
Copy link
Contributor

Then the first sample of code I posted above might be the best solution then 😉

@javiereguiluz
Copy link
Member Author

OK, I've updated the securit.yml file as follows:

security:

    providers:
        in_memory:
            memory: ~

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt|error)|css|images|js)/
            security: false

        main:
            anonymous: ~

@Tobion
Copy link
Contributor

Tobion commented Jun 11, 2015

👍


login:
pattern: ^/demo/secured/login$
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the |error part here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the Twig bundle IIRC, and allows you to check your error
templates, so I'd say yes, we might need it :)

2015-06-11 12:58 GMT+02:00 Christian Flothmann notifications@github.com:

In app/config/security.yml
#818 (comment)
:

 firewalls:
     dev:
  •        pattern:  ^/(_(profiler|wdt)|css|images|js)/
    

- security: false

  •    login:
    
  •        pattern:  ^/demo/secured/login$
    
  •        pattern: ^/(_(profiler|wdt|error)|css|images|js)/
    

Do we really need the |error part here?


Reply to this email directly or view it on GitHub
https://github.com/symfony/symfony-standard/pull/818/files#r32209761.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but only in Symfony 2.6 or higher.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh you are right. I've just remoed _error path for 2.3. Thanks.

@xabbuh
Copy link
Member

xabbuh commented Jun 11, 2015

👍

@fabpot
Copy link
Member

fabpot commented Jun 11, 2015

Thank you @javiereguiluz.

@fabpot fabpot merged commit cdddfa0 into symfony:2.3 Jun 11, 2015
fabpot added a commit that referenced this pull request Jun 11, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[2.3] Remove Acme Demo bundle

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This removes the AcmeDemoBundle for Symfony Standard 2.3. I'm going to send another pull request for Symfony 2.6+.

Commits
-------

cdddfa0 Removed the "_error" path from the sample security.yml file
2e60a9f Simplified the security.yml configuration
edc56be Removed AcmeDemoBundle
@javiereguiluz javiereguiluz deleted the remove_demo_bundle branch July 22, 2015 07:28
weaverryan added a commit to symfony/symfony-docs that referenced this pull request Aug 2, 2016
This PR was submitted for the 3.1 branch but it was merged into the 2.7 branch instead (closes #6796).

Discussion
----------

Remove AcmeDemoBundle references

After symfony/symfony-standard#819 and symfony/symfony-standard#818 last year the AcmeDemoBundle doesn't exist so having an article dedicated to it doesn't appear to make much sense. This adapts the article to be focused on removing 'a bundle'.

Commits
-------

9476cfa Remove AcmeDemoBundle references
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants