Permalink
Browse files

aggiornamento

  • Loading branch information...
1 parent 752a48d commit f528258a786f9aeea03d7d9d92c507eadf406a09 @garak committed Apr 30, 2012
Showing with 29 additions and 16 deletions.
  1. +29 −16 cookbook/security/entity_provider.rst
@@ -46,16 +46,16 @@ modo da focalizzarsi sui metodi più importanti, provenienti da
namespace Acme\UserBundle\Entity;
- use Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping as ORM;
+ use Symfony\Component\Security\Core\User\UserInterface;
/**
* Acme\UserBundle\Entity\User
*
* @ORM\Table(name="acme_users")
* @ORM\Entity(repositoryClass="Acme\UserBundle\Entity\UserRepository")
*/
-class User implements UserInterface
+ class User implements UserInterface
{
/**
* @ORM\Column(type="integer")
@@ -176,14 +176,14 @@ creazione delle righe degli utenti e sulla codifica delle password, vedere :ref:
.. code-block:: text
mysql> select * from user;
- +----+----------+------------------------------------------+------------------------------------------+--------------------+-----------+
- | id | username | salt | password | email | is_active |
- +----+----------+------------------------------------------+------------------------------------------+--------------------+-----------+
- | 1 | hhamon | 7308e59b97f6957fb42d66f894793079c366d7c2 | 09610f61637408828a35d7debee5b38a8350eebe | hhamon@example.com | 1 |
- | 2 | jsmith | ce617a6cca9126bf4036ca0c02e82deea081e564 | 8390105917f3a3d533815250ed7c64b4594d7ebf | jsmith@example.com | 1 |
- | 3 | maxime | cd01749bb995dc658fa56ed45458d807b523e4cf | 9764731e5f7fb944de5fd8efad4949b995b72a3c | maxime@example.com | 0 |
- | 4 | donald | 6683c2bfd90c0426088402930cadd0f84901f2f4 | 5c3bcec385f59edcc04490d1db95fdb8673bf612 | donald@example.com | 1 |
- +----+----------+------------------------------------------+------------------------------------------+--------------------+-----------+
+ +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+
+ | id | username | salt | password | email | is_active |
+ +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+
+ | 1 | hhamon | 7308e59b97f6957fb42d66f894793079 | 09610f61637408828a35d7debee5b38a8350eebe | hhamon@example.com | 1 |
+ | 2 | jsmith | ce617a6cca9126bf4036ca0c02e82dee | 8390105917f3a3d533815250ed7c64b4594d7ebf | jsmith@example.com | 1 |
+ | 3 | maxime | cd01749bb995dc658fa56ed45458d807 | 9764731e5f7fb944de5fd8efad4949b995b72a3c | maxime@example.com | 0 |
+ | 4 | donald | 6683c2bfd90c0426088402930cadd0f8 | 5c3bcec385f59edcc04490d1db95fdb8673bf612 | donald@example.com | 1 |
+ +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+
4 rows in set (0.00 sec)
Il database ora contiene quattro utenti, con differenti nomi, email e status. Nella
@@ -208,12 +208,17 @@ saranno poi verificate sulla nostra entità ``User``, nel database:
.. code-block:: yaml
# app/config/security.yml
+
security:
encoders:
Acme\UserBundle\Entity\User:
- algorithm: sha1
+ algorithm: sha1
encode_as_base64: false
- iterations: 1
+ iterations: 1
+
+ role_hierarchy:
+ ROLE_ADMIN: ROLE_USER
+ ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
providers:
administrators:
@@ -477,13 +482,19 @@ un metodo ``getRole()``::
*/
private $id;
- /** @ORM\Column(name="name", type="string", length=30) */
+ /**
+ * @ORM\Column(name="name", type="string", length=30)
+ */
private $name;
- /** @ORM\Column(name="role", type="string", length=20, unique=true) */
+ /**
+ * @ORM\Column(name="role", type="string", length=20, unique=true)
+ */
private $role;
- /** @ORM\ManyToMany(targetEntity="User", mappedBy="groups") */
+ /**
+ * @ORM\ManyToMany(targetEntity="User", mappedBy="groups")
+ */
private $users;
public function __construct()
@@ -493,7 +504,9 @@ un metodo ``getRole()``::
// ... getter e setter per ogni proprietà
- /** @see RoleInterface */
+ /**
+ * @see RoleInterface
+ */
public function getRole()
{
return $this->role;

0 comments on commit f528258

Please sign in to comment.