Пример #1
0
 /**
  * @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);
 }
Пример #2
0
 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));
 }