This is a spinoff from #1780646: entity_access() fails to check node type specific create access.

Currently, entity metadata wrappers property level access do not distinguish between create and update operations, instead implementing a single 'edit' operation. As part of the process, they also call back to the entity level access callback for the host entity.

This is problematic when trying to check access for properties on new entities, because the entity-level access callback is always called with the 'update' op, and some such callbacks -- including entity_metadata_no_hook_node_access() -- assume (rightly) that an entity being updated will have an identifier.

One immediate consequence is that notices are generated when trying to check property access for any unsaved node. There are likely to be other consequences as well.

Proposed solution: invoke entity access callbacks with the 'create' op when the wrapper has not identifer, and with the 'update' op otherwise.

CommentFileSizeAuthor
#1 2203961-entity-property-access.patch1.13 KBwodenx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wodenx’s picture

Status: Active » Needs review
FileSize
1.13 KB

Attaching patch.

Status: Needs review » Needs work

The last submitted patch, 1: 2203961-entity-property-access.patch, failed testing.