Let's say I have models that are subjects to rights when used by users, but not when used by business logic.
For exemple: When one create an item A, it automaticaly creates an Item B.
Users must have the right to create A or B if he wants to create one. But the business logic when creating B from A doesn't need any rights.
If I put the right system in business logic, I get classes that have strong dependancy to the session and A can't create a B if the logged in user doesn't have the right.
If I put rights managements in controlers, I feel like my business logic isn't safe as any programmer could forget to test rights before creating an item and wouldn't be stopped, plus there's code duplication if 2 controllers are able to update an item for any reason.
Where would you put the rights management ?
I coul create inheritance of every objet that would be used by controllers, and implement rights limitation, while business logic would access the objects themselves. Controllers create UserA, UserB while object A directly creates a B object. But it sounds like I'll have to duplicate (inherit) every single business logic objet that has to be used in a controller, thus a solid 80% of them.