예제 #1
0
파일: Acl.php 프로젝트: alexdpy/acl
 /**
  * @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));
 }