Problem/Motivation

When using a Drupal "add entity" form to create an entity that inherits fields from another entity, the permission "administer field inheritance" is required, or fields will not inherit.

At the top of function field_inheritance_form_alter(), the function returns if the user does not have the permission 'administer field inheritance'. This was added in #3330386: field_inheritance_form_alter should enforce module permissions, and the intention was to hide the option to enable, disable or configure field inheritance on entity forms.

By requiring administrative permission, field inheritance is effectively disabled for non-admin users. Information about inherited fields is not added to the form and field_inheritance_entity_form_submit() is not invoked.

Steps to reproduce

1. Configure recurring events (depending on field_inhertiance 2.x) with an eventinstance entity that inherits a field from an eventseries entity.
2. Create a role, "event creator", that is allowed to create and update event series and event instances but not administer field inheritance
3. As a user with the "event creator" role, create an eventseries entity that includes the inherited field.
4. As a user with the "event creator" role, add an instance to the series.
5. Observe the field is not inherited on the new event instance.

Proposed resolution

Two approaches:

1. We could separate permissions for administering field_inheritance and using it at all. This would require site owners to also update roles and permissions after this update.

or

2. Require 'administer field inheritance' only on some parts of the form, and assume that field inheritance should be enabled for configured entities unless explicitly disabled.

Remaining tasks

What is the maintainers' preferred approach?

User interface changes

No

API changes

No

Data model changes

No

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

calebtr created an issue. See original summary.

calebtr’s picture

Status: Active » Needs review

I implemented solution #2 for my local case. I think we don't want to add complexity to the 2.x branch. If it works for the project, I made an MR.

camilo.escobar’s picture

This appears to be a duplicate of #3454350: Create seperate permission for adding field inheritance, where a patch proposes a solution based on new separate permission 'administer entity field inheritance', to address the issue for sites that need to remain on version 2 for the time being.

As also noted in that issue, version 3 introduces a fundamentally different approach: inheritance is implemented as an entity field with its own widget. As a result, its usage and visibility can be managed through modules such as Field Permissions.