Exemplo n.º 1
0
 /**
  * Returns the permissions for all security identities.
  *
  * @param string $type The type of the protected object
  * @param string $identifier The identifier of the protected object
  *
  * @return array
  */
 public function getPermissions($type, $identifier)
 {
     $accessControls = $this->accessControlRepository->findByTypeAndId($type, $identifier);
     $permissions = [];
     foreach ($accessControls as $accessControl) {
         $permissions[$accessControl->getRole()->getId()] = $this->maskConverter->convertPermissionsToArray($accessControl->getPermissions());
     }
     return $permissions;
 }
 public function testGetPermissionsForNotExistingAccessControl()
 {
     $this->accessControlRepository->findByTypeAndId('AcmeBundle\\Example', 1)->willReturn([]);
     $this->assertEquals($this->doctrineAccessControlProvider->getPermissions('AcmeBundle\\Example', 1), []);
 }