/** * @param PermissionInterface $permission */ protected function savePermission(PermissionInterface $permission) { if (0 === $permission->getMask()) { if ($permission->isPersistent()) { $this->databaseProvider->deletePermission($permission); $permission->setPersistent(false); } $this->permissionBuffer->add($permission); return; } if ($permission->isPersistent()) { $this->databaseProvider->updatePermission($permission); } else { $this->databaseProvider->insertPermission($permission); $permission->setPersistent(true); } $this->permissionBuffer->add($permission); }
public function testInsertPermission() { $this->databaseProvider->insertPermission(new Permission($this->aliceRequester, $this->fooResource, new BasicMaskBuilder(3))); $this->assertEquals(['requester' => $this->aliceRequester->getAclRequesterIdentifier(), 'resource' => $this->fooResource->getAclResourceIdentifier(), 'mask' => 3], $this->findFixture($this->aliceRequester, $this->fooResource)); }