[ai_agents_form_integration] Incorrect access check used for field type creation access

Created on 11 December 2024, 4 months ago

Problem/Motivation

The custom route "ai_agents_form_integration.field_type_creation_$entity_type_id" added by the module to allow users to AI Generate new fields on a content type borrows the Field UI module's _field_ui_field_reuse_access custom access check to control access to the generation form.

This access check is used for the "Reuse Existing Field" link that appears on the Field UI page to allow users to add a field that is used on another bundle of the same entity type but has not been added to the bundle currently being configured. It is designed to deny access to a route using it if all the available fields created for an entity have already been added to that bundle. This means that if you visit the Manage Fields form for a Node type that has all the fields currently created for Nodes added to it, you will not see the "Create Field Types with AI" button.

Steps to reproduce

Visit the Manage Fields form for any entity.
Click the "Reuse existing field" link and keep adding existing fields to the entity until there are no more to add
The "Create Field Types with AI" button will no longer appear.

Proposed resolution

It seems likely that the module's custom route wants to use the same access as the main Manage Fields form it displays on - the permission 'administer ' . $entity_type_id . ' fields'. Alternatively, it should just use the create ai assisted field types permission directly.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom MrDaleSmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024