Feature/entitlements

This implements the Entitlements scheme proposal by @ahgittin
It adds entitlement checks for ApplicationResource and EntityResource only, to verify that direction is right.