Skip to content

Commit

Permalink
Fixed Symfony2 doc
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Apr 20, 2012
1 parent ab619e4 commit 26e325c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
Expand Up @@ -11,13 +11,29 @@ If you've started to play with the awesome Symfony2 Security Component, you'll k
to retrieve your users. Symfony2, and the PropelBundle provide a `propel` provider, so you just need to add the following
configuration to your `security.yml` file:

``` yaml
{% highlight yaml %}
# app/config/security.yml
providers:
main:
propel:
class: My\AwesomeBundle\Model\User
property: username
```
{% endhighlight %}

Your `User` class have to implement the [`UserInterface`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Core/User/UserInterface.php):

{% highlight php %}
<?php
// src/My/AwesomeBundle/Model/User.php
use Symfony\Component\Security\Core\User\UserInterface;
class User extends BaseUser implements UserInterface
{
}
{% endhighlight %}
That's all!
## ACL implementation ##
Expand Down
24 changes: 14 additions & 10 deletions cookbook/symfony2/working-with-symfony2.markdown
Expand Up @@ -542,9 +542,11 @@ If you want to remove parts of a schema, you only need to add an empty schema fi
The `PropelBundle` provides a model-based implementation of the Security components' interfaces.
To make use of this `AuditableAclProvider` you only need to change your security configuration.
security:
acl:
provider: propel.security.acl.provider
{% highlight yaml %}
security:
acl:
provider: propel.security.acl.provider
{% endhighlight %}
This will switch the provider to be the `AuditableAclProvider` of the `PropelBundle`.
Expand All @@ -558,13 +560,15 @@ If you already got an ACL database, the schema of the `PropelBundle` is compatib
In case you want to use a different database for your ACL than your business model, you only need to configure this service.
services:
propel.security.acl.connection:
class: PropelPDO
factory_class: Propel
factory_method: getConnection
arguments:
- "acl"
{% highlight yaml %}
services:
propel.security.acl.connection:
class: PropelPDO
factory_class: Propel
factory_method: getConnection
arguments:
- "acl"
{% endhighlight %}
The `PropelBundle` looks for this service, and if given uses the provided connection for all ACL related operations.
The given argument (`acl` in the example) is the name of the connection to use, as defined in your runtime configuration.

0 comments on commit 26e325c

Please sign in to comment.