Pass the model to the security context when checking credentials.

Hello,

With this small change, the ProcessHandler pass the model to the isGranted method of the security context. This would allow either to use Symfony ACL system or to implement model-based authorization checks in a custom Voter. I have to do this in one of my project and I would prefer have this solution than simulating it with a custom pre-validation listener.

Regards,
Adirelle.

This would be required only to use Symfony's ACL. With a custom voter, one would already expect the model to be of a given class.

Adding a method to ModelInterface would work but this would also break existing code. A non-breaking change would be to add a new interface, something like ModelWithObjectInterface, e.g. : https://gist.github.com/Adirelle/ee9f050129534e7f2afe (I would name it "Object", since I suppose the subject of the workflow is actually the actor, but this is not definitive).

Any preference ?

Note that the changes I submitted already break any class which extends ProcessHandler to override checkCredentials.