Problem/Motivation

Installing the 'AI Assistant' recipe introduces an 'Access denied' issue when trying to add media.

I first found the issue in the current version and so reproduced in current dev version.

This is a major error which makes Drupal CMS unusable.

Steps to reproduce

Install latest dev version of Drupal CMS:

git clone https://git.drupalcode.org/project/drupal_cms.git
cd drupal_cms
ddev config --project-type=drupal11 --docroot=web --php-version=8.3
ddev start
ddev composer install 
ddev launch

Carry on with install, selecting site name, 'Starter' template and entering credentials.

Click: Media > Add Media > Add image
All fine.
Add image dialogue

Then install the AI Assistant:
Extend > Recommended add-ons > AI Assistant

Click: Media > Add Media
You see an access denied error.
Access denied error

I'm logged in as the admin user still.

The error in the logs is:
Path: /admin/content/media/bulk-upload. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 114 of /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

Proposed resolution

User interface changes

Configuration changes

Comments

dunx created an issue. See original summary.

dunx’s picture

I've done some additional investigation, starting from a base install of the current Drupal CMS and installing each module listed in the AI Assistant yaml before checking for the error.

I installed:

  1. key - OK
  2. block - already enabled
  3. taxonomy - already enabled
  4. ai - OK
  5. ai_dashboard - OK
  6. ai_provider_amazeeio - OK
  7. ai_provider_openai - OK
  8. ai_provider_anthropic - OK
  9. ai_image_alt_text - OK
  10. ai_assistant_api - OK
  11. ai_chatbot - OK
  12. ai_agents - OK
  13. canvas_ai (via composer) - OK
  14. canvas_stark (via composer) - OK
  15. easy_encryption_admin + easy_encryption prerequisite - ERROR

If I uninstall easy_encryption_admin, the error no longer occurs.

So the issue seems to be caused by the easy_encryption or easy_encryption_admin module. That had a new version 2 weeks ago, so the issue could have been introduced there.

This issue could be related https://www.drupal.org/project/easy_encryption/issues/3589914

dunx’s picture

Fresh install of Drupal CSM. Enable easy_encryption and easy_encryption_admin (plus key) then the error manifests.

dunx’s picture

More specifically, it seems to be the easy_encryption_admin module that's causing the issue. I install the whole of the AI Assistant recipe and just remove the admin module and the error no longer occurs.

dunx’s picture

Title: Installing AI Assistant recipe breaks 'Add Media' function - access denied » Installing easy encryption admin (via AI Assistant recipe on Drupal CMS) breaks 'Add Media' function - access denied
Project: Drupal CMS development repository » Easy Encryption
Version: » 1.0.2
Component: General » easy_encryption_admin

Updated project accordingly.

mxr576’s picture

Status: Active » Closed (duplicate)

I have just realized due to a Drupal Slack ping that I have not got notification about this issue (or it lost in my mailbox).

Closing this as a duplicate of #3589914: Remove global _custom_access registration from Easy Encryption admin access checker which already has a patch to be ported.

Thanks for the detailed report here!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.