8000 Fix custom Roles in entity_provider cookbook. · symfony/symfony-docs@dd04a2e · GitHub
[go: up one dir, main page]

Skip to content

Commit dd04a2e

Browse files
committed
Fix custom Roles in entity_provider cookbook.
The documentation seems to assume the implementation present in commit symfony/symfony#1673, which reverted soon after due to a potential, but undisclosed security hole (citation @schmittjoh in symfony/symfony@af70ac8). This incorrect documentation has likely been the source of many of the following issues: * symfony/symfony#1538 - [ACL RoleSecurityIdentity] check if instance of Role * symfony/symfony#1748 - Replace Role to RoleInterface for RoleSecurityIdentity * symfony/symfony#4309 - Issue related to custom group (role) and ACL/ACE * symfony/symfony#5026 - potential bug in Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity * symfony/symfony#5076 - [Acl] altered the behaviour of RoleSecurityIdentity * symfony/symfony#5171 - Fix/role security identity * symfony/symfony#5303 - [Security] Check for RoleInterface instead of Role object in RoleSecurityIdentity * symfony/symfony#5909 - Allow Custom Roles to implement the RoleInterface * symfony/symfony#6012 - Securityidentity fix
1 parent b84abc6 commit dd04a2e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cookbook/security/entity_provider.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,21 +592,20 @@ The ``AcmeUserBundle:Group`` entity class defines three table fields (``id``,
592592
``name`` and ``role``). The unique ``role`` field contains the role name used by
593593
the Symfony security layer to secure parts of the application. The most
594594
important thing to notice is that the ``AcmeUserBundle:Group`` entity class
595-
implements the :class:`Symfony\\Component\\Security\\Core\\Role\\RoleInterface`
596-
that forces it to have a ``getRole()`` method::
595+
extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`::
597596
598597
// src/Acme/Bundle/UserBundle/Entity/Group.php
599598
namespace Acme\UserBundle\Entity;
600599
601-
use Symfony\Component\Security\Core\Role\RoleInterface;
600+
use Symfony\Component\Security\Core\Role\Role;
602601
use Doctrine\Common\Collections\ArrayCollection;
603602
use Doctrine\ORM\Mapping as ORM;
604603
605604
/**
606605
* @ORM\Table(name="acme_groups")
607606
* @ORM\Entity()
608607
*/
609-
class Group implements RoleInterface
608+
class Group extends Role
610609
{
611610
/**
612611
* @ORM\Column(name="id", type="integer")

0 commit comments

Comments
 (0)
0