Skip to content

Commit d659215

Browse files
committed
Merge branch 'security' of https://github.com/schmittjoh/symfony-docs into schmittjoh-security
2 parents 2efc711 + b591099 commit d659215

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

book/security/acl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Checking Access
146146
$securityContext = $this->container->get('security.context');
147147
148148
// check for edit access
149-
if (false === $securityContext->vote('EDIT', $comment))
149+
if (false === $securityContext->isGranted('EDIT', $comment))
150150
{
151151
throw new AccessDeniedException();
152152
}

book/security/authorization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ syntax:
183183

184184
.. code-block:: php
185185
186-
<?php if ($view['security']->vote('ROLE_ADMIN')): ?>
186+
<?php if ($view['security']->isGranted('ROLE_ADMIN')): ?>
187187
<a href="...">Delete</a>
188188
<?php endif ?>
189189

book/security/users.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ The user provider must implement
2929
interface UserProviderInterface
3030
{
3131
function loadUserByUsername($username);
32-
function loadUserByAccount(AccountInterface $account);
32+
function loadUser(UserInterface $user);
3333
function supportsClass($class);
3434
}
3535

3636
* ``loadUserByUsername()``: Receives a username and returns the corresponding
3737
user object. If the username is not found, it must
3838
throw :class:`Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException`
3939
exception.
40-
* ``loadUserByAccount()``: Receives an ``AccountInterface`` object, and must reload
40+
* ``loadUser()``: Receives an ``UserInterface`` object, and must reload
4141
the corresponding user object, or just merge the user
4242
into the identity map of an ``EntityManager``. If the
4343
given account's class is not supported, it must throw
@@ -53,22 +53,22 @@ The user provider must implement
5353
information.
5454

5555
.. index::
56-
single: Security; AccountInterface
56+
single: Security; UserInterface
5757

58-
AccountInterface
58+
UserInterface
5959
~~~~~~~~~~~~~~~~
6060

6161
The user provider must return objects that implement
62-
:class:`Symfony\\Component\\Security\\Core\\User\\AccountInterface`::
62+
:class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`::
6363

64-
interface AccountInterface
64+
interface UserInterface
6565
{
6666
function getRoles();
6767
function getPassword();
6868
function getSalt();
6969
function getUsername();
7070
function eraseCredentials();
71-
function equals(AccountInterface $account);
71+
function equals(UserInterface $user);
7272
}
7373

7474
* ``getRoles()``: Returns the roles granted to the user;
@@ -187,22 +187,22 @@ options, you only need to select the one which suits your needs best:
187187
You must define an encoder for each of your user classes, but the
188188
configuration *must not* overlap. If you want to use the same encoder for
189189
all classes you can simply specify
190-
:class:`Symfony\\Component\\Security\\Core\\User\\AccountInterface` as class
190+
:class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` as class
191191
since all your user classes will implement it.
192192

193193
.. index::
194-
single: Security; AdvancedAccountInterface
194+
single: Security; AdvancedUserInterface
195195

196-
AdvancedAccountInterface
196+
AdvancedUserInterface
197197
~~~~~~~~~~~~~~~~~~~~~~~~
198198

199199
Before and after authentication, Symfony2 can check various flags on the user.
200200
If your user class implements
201-
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedAccountInterface` instead
202-
of :class:`Symfony\\Component\\Security\\Core\\User\\AccountInterface`, Symfony2
201+
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface` instead
202+
of :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`, Symfony2
203203
will make the associated checks automatically::
204204

205-
interface AdvancedAccountInterface extends AccountInterface
205+
interface AdvancedUserInterface extends UserInterface
206206
{
207207
function isAccountNonExpired();
208208
function isAccountNonLocked();
@@ -219,7 +219,7 @@ will make the associated checks automatically::
219219

220220
.. note::
221221

222-
The :class:`Symfony\\Component\\Security\\Core\\User\\AdvancedAccountInterface`
222+
The :class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface`
223223
relies on an
224224
:class:`Symfony\\Component\\Security\\Core\\User\\AccountCheckerInterface`
225225
object to do the pre-authentication and post-authentication checks.
@@ -296,7 +296,7 @@ Most of the time, users are described by a Doctrine Entity::
296296
/**
297297
* @orm:Entity
298298
*/
299-
class User implements AccountInterface
299+
class User implements UserInterface
300300
{
301301
// ...
302302
}
@@ -344,7 +344,7 @@ implement :class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterfac
344344
/**
345345
* @Entity(repositoryClass="SecurityBundle:UserRepository")
346346
*/
347-
class User implements AccountInterface
347+
class User implements UserInterface
348348
{
349349
// ...
350350
}
@@ -363,7 +363,7 @@ implement :class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterfac
363363
.. tip::
364364

365365
If you use the
366-
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedAccountInterface`
366+
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface`
367367
interface, don't check the various flags (locked, expired, enabled, ...)
368368
when retrieving the user from the database as this will be managed by the
369369
authentication system automatically (and proper exceptions will be thrown
@@ -506,7 +506,7 @@ implement :class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterfac
506506
/**
507507
* @Document(repositoryClass="SecurityBundle:UserRepository")
508508
*/
509-
class User implements AccountInterface
509+
class User implements UserInterface
510510
{
511511
// ...
512512
}
@@ -525,7 +525,7 @@ implement :class:`Symfony\\Component\\Security\\Core\\User\\UserProviderInterfac
525525
.. tip::
526526

527527
If you use the
528-
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedAccountInterface`
528+
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface`
529529
interface, don't check the various flags (locked, expired, enabled, ...)
530530
when retrieving the user from the database as this will be managed by the
531531
authentication system automatically (and proper exceptions will be thrown

0 commit comments

Comments
 (0)