瀏覽代碼

Check all role (#4130)

The role must be checked separately
Baltox 8 年之前
父節點
當前提交
e3f1d508c2
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 3 2
      Security/Handler/RoleSecurityHandler.php
  2. 1 0
      Tests/Security/Handler/RoleSecurityHandlerTest.php

+ 3 - 2
Security/Handler/RoleSecurityHandler.php

@@ -62,11 +62,12 @@ class RoleSecurityHandler implements SecurityHandlerInterface
             $attributes[$pos] = sprintf($this->getBaseRole($admin), $attribute);
         }
 
-        $attributes[] = sprintf($this->getBaseRole($admin), 'ALL');
+        $allRole = sprintf($this->getBaseRole($admin), 'ALL');
 
         try {
             return $this->authorizationChecker->isGranted($this->superAdminRoles)
-                || $this->authorizationChecker->isGranted($attributes, $object);
+                || $this->authorizationChecker->isGranted($attributes, $object)
+                || $this->authorizationChecker->isGranted(array($allRole), $object);
         } catch (AuthenticationCredentialsNotFoundException $e) {
             return false;
         }

+ 1 - 0
Tests/Security/Handler/RoleSecurityHandlerTest.php

@@ -180,6 +180,7 @@ class RoleSecurityHandlerTest extends \PHPUnit_Framework_TestCase
 
             // ALL role
             array(true, array(), 'foo.bar.baz', 'LIST'),
+            array(true, array(), 'foo.bar.baz', array('LIST', 'EDIT')),
         );
     }