In #1954124: Fields part of field collection are ownerless, there is a pretty long-running discussion on field_permissions failing with field_collection items. One could argue on "who's to blame" (I figure it is core for not yet having introduced a consistent concept of entity ownership), but blaming won't help much with moving toward *any* sensible and projectable behaviour.

Thus I would like to suggest a simple 2-step workaround:

a) add a settings option "permissions for ownerless fields"
b) apply this default whenever no other acl can be applied.

Should not be too much of an effort and in case this is desired, I would probably volunteer. Opinions?

Comments

doitDave created an issue. See original summary.

mariacha1’s picture

Status: Active » Closed (duplicate)

If all we care about here are field collections, this is a duplicate of #1954124: Fields part of field collection are ownerless. If there are other ownerless entities, additional hooks can be added to the field permission module (within reason) or to the module initiating the entity via the hook added there.

Hook:

function hook_field_permissions_userid_ENTITY_TYPE_alter(&$uid, $entity) {
  // This example always assigns user 15 as the owner of an entity.
  $uid = 15;

Example implementation:


/**
 * Implements hook_field_permissions_userid_ENTITY_TYPE_alter().
 */
function field_permissions_field_permissions_userid_field_collection_item_alter(&$uid, $entity) {
  $uid = isset($entity->hostEntity()->uid) ? $entity->hostEntity()->uid : $uid;
}