/**
  * @dataProvider provideObjectIdentifiers
  */
 public function testPermissionUpdateEvent($objectId, $objectType, $objectIdentifier)
 {
     $this->aclProvider->findAcl(new ObjectIdentity($objectIdentifier, $objectType))->willThrow(AclNotFoundException::class);
     $this->aclProvider->createAcl(new ObjectIdentity($objectIdentifier, $objectType))->willReturn($this->acl->reveal())->shouldBeCalled();
     $this->aclProvider->updateAcl($this->acl->reveal())->shouldBeCalled();
     $this->acl->getObjectAces()->willReturn([]);
     $this->acl->insertObjectAce(Argument::cetera())->shouldBeCalled();
     $this->accessControlManager->setPermissions($objectType, $objectId, [$this->securityIdentity->getRole() => ['view']]);
 }
 /**
  * @dataProvider provideObjectIdentifiers
  */
 public function testPermissionUpdateEvent($objectId, $objectType, $locale, $objectIdentifier)
 {
     $this->aclProvider->findAcl(new ObjectIdentity($objectIdentifier, $objectType))->willThrow(AclNotFoundException::class);
     $this->aclProvider->createAcl(new ObjectIdentity($objectIdentifier, $objectType))->willReturn($this->acl->reveal())->shouldBeCalled();
     $this->aclProvider->updateAcl($this->acl->reveal())->shouldBeCalled();
     $this->acl->getObjectAces()->willReturn([]);
     $this->acl->insertObjectAce(Argument::cetera())->shouldBeCalled();
     $this->eventDispatcher->dispatch('sulu.security.permission.update', new PermissionUpdateEvent($objectType, $objectIdentifier, $this->securityIdentity, ['view']))->shouldBeCalled();
     $this->accessControlManager->setPermissions($objectType, $objectId, $this->securityIdentity, ['view'], $locale);
 }
 /**
  * Insert ACL entries
  * 
  * @param MutableAclInterface  $acl
  * @param array                $insert
  */
 protected function insertAclEntries(MutableAclInterface $acl, array $insert)
 {
     foreach ($insert as $entry) {
         $identity = $entry['identity'];
         $permission = $entry['permission'];
         if ($identity instanceof UserInterface) {
             $identity = UserSecurityIdentity::fromAccount($identity);
         } elseif (is_string($identity)) {
             $identity = new RoleSecurityIdentity($identity);
         }
         $acl->insertObjectAce($identity, $permission);
     }
 }