We deal with nodes representing humans with two important properties: mother and father.
Your parents as well as your aunts and uncles should get extra permissions, like to see you in a certain view mode, or to see your private images.
Where should I place this complex access control in a way that I can easily call it in several controllers and hooks?
Is there a name for the kind of feature I'm going to program?
If there's no better idea, I would go with a validation. We could put the access control in a validator that we use like this:
$errors = $family_access_validator->validate($node);
if (count($errors) > 0) {
throw new AccessDeniedHttpException();
}
However, I'm not sure whether this is the correct approach. When we use validation, we are always interested in the message why the data is rejected. Here, we are only interested in OK or not OK.