From 153906e8622485e618bcab622a80a5a3dc64770f Mon Sep 17 00:00:00 2001 From: iBiryukov Date: Mon, 5 Nov 2012 03:39:07 +0000 Subject: [PATCH] Allow Custom Roles to implement the RoleInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow Custom roles to implement the RoleInterface rather than concreate class. Otherwise, in the constructor, if a custom role (that implements the interface only) is provided, the if statement is never entered.  And then the comparison in equals method fails too. Spent an honour debugging why my class level roles based permissions  weren't working. --- .../Component/Security/Acl/Domain/RoleSecurityIdentity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/Acl/Domain/RoleSecurityIdentity.php b/src/Symfony/Component/Security/Acl/Domain/RoleSecurityIdentity.php index 0d3d0d2ca2b14..2c7db29cbae48 100644 --- a/src/Symfony/Component/Security/Acl/Domain/RoleSecurityIdentity.php +++ b/src/Symfony/Component/Security/Acl/Domain/RoleSecurityIdentity.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Security\Acl\Domain; use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; -use Symfony\Component\Security\Core\Role\Role; +use Symfony\Component\Security\Core\Role\RoleInterface; /** * A SecurityIdentity implementation for roles @@ -30,7 +30,7 @@ final class RoleSecurityIdentity implements SecurityIdentityInterface */ public function __construct($role) { - if ($role instanceof Role) { + if ($role instanceof RoleInterface) { $role = $role->getRole(); }