I'm considering passing the latest node to field_access() to check access (aka the right entity passed to diff), but will leave this issue open for a few days to get feedback.
In theory, two different entity types can be passed so that field access results may be different to the left and right entities (in the case, the logic is already flawed here as the entity type of the right entity is used)
So simple version would go something like this:
- if (field_access('view', $field, $entity_type) || field_access('edit', $field, $entity_type)) {
+ if (field_access('view', $field, $entity_type, $new_entity) || field_access('edit', $field, $entity_type, $new_entity)) {
A complete access check would check access separately for both, and then either:
1) No access to either = ignore field in diff
2) Access to both = standard diff field comparison
3) Access to one = render normally for field with access and provide text similar to "Value of this field is protected" for the other field.
This then leads onto node_entity_diff() that could also provide a content type comparison if we are going to support this.
Comments
Comment #1
alan d. commentedStaying with the status quo