KnpLabs/KnpRadBundle — pull request #65 by docteurklein (2013-03-13 21:15:50+00:00)
Title: Feature/owner security voter

Permits to use the decision manager system to check if an object implementing `OwnableInterface` is owned by an object implementing `OwnerInterface`.

If object implementing `OwnerInterface` also implements `EquatableInterface` and `UserInterface`, it will be used to check equality of owner.

``` php

class Post implements OwnableInterface
{
/**
* @ORM\ManyToOne(targetEntity="User")
**/
public $createdBy;

public function getOwner()
{
return $this->createdBy;
}
}

class User implements OwnerInterface, UserInterface, EquatableInterface
{
}

$securityContext->isGranted('IS_OWNER', new Post); // true if Post::createdBy is current logged in user

```