Problem/Motivation
After adding a Reaction field, site builders must grant view, create and modify permissions before visitors can use it. This requirement is easy to miss, and an open field may appear broken to visitors.
Proposed resolution
When a Reaction field is created, grant the Anonymous and Authenticated roles permission to view, add and modify reactions for that field and bundle. Administrators can revoke these permissions on the Permissions page.
Apply the defaults once when the field is created. Editing the field must respect subsequent permission changes. Existing fields retain their current permissions after a module update.
Remaining tasks
- Grant the Anonymous and Authenticated roles view, create and modify reaction permissions when a new Reaction field is created.
- Keep existing fields and permissions unchanged during module updates and configuration imports.
- Ensure editing a field does not restore permissions an administrator has revoked.
- Add tests for field creation, permission changes and configuration import.
User interface changes
The relevant permissions will be checked by default for Anonymous and Authenticated users when a new Reaction field is created. Administrators can change them on the Permissions page.
API changes
None anticipated.
Data model changes
Creating a Reaction field will add permissions for that field and bundle to the Anonymous and Authenticated role configuration. Existing fields will retain their current permissions.
Issue fork votingapi_reaction-3637916
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
Comment #4
elamanMerged. New reaction fields now grant Anonymous and Authenticated users permission to view, create, and modify reactions by default. Administrators can change those permissions afterward.
Existing field permissions and imported configuration are preserved. Deleting a field also removes its permissions from roles when their field dependencies are recorded.
Tested on Drupal 10 and 11.