예제 #1
0
 /**
  * Apply resource ownership
  * 
  * @return boolean
  */
 protected function applyForResource()
 {
     if (is_null($this->resource)) {
         return true;
     }
     return $this->resource->isBelongsTo($this->user);
 }
예제 #2
0
 function it_can_check_for_resource_owner(User $user, Resource $resource)
 {
     $resource->isBelongsTo($user)->shouldBeCalled()->willReturn(false);
     $user->abilities()->shouldBeCalled()->willReturn(['update']);
     $this->forResource($resource)->check('update')->shouldEqual(false);
 }