tommysonsylverstone / sulu-elasticsearch-user-bug

Trying to reproduce the bug where a logged in sulu user can't see articles rendered by smart_content content type or alikes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steps

  1. Initialize new project composer composer create-project sulu/skeleton my-project -n
  2. Add translation bin/console sulu:admin:download-language
  3. Create database and initialize bin/adminconsole sulu:build dev
  4. Download the elasticsearch version that matches your installation's (7.17 in my case) composer require "elasticsearch/elasticsearch:7.17.*"
  5. Download the article bundle (latest) composer require sulu/article-bundle
  6. Download elasticsearch bundle composer require "handcraftedinthealps/elasticsearch-bundle:^5.2"
  7. (optionnal) Modify ELASTICSEARCH_INDEX value in your .env file
  8. Create elasticsearch indexes
php bin/console ongr:es:index:create
php bin/console ongr:es:index:create --manager=live
  1. Activate all your articles rights in your User settings Settings > User roles > your role
  2. Create a smart content in your homepage.xml
  3. Render your smart content in your homepage.html.twig
  4. Create a user role php bin/console sulu:security:role:create and assign it the website system
  5. Create a new user either in your admin or php bin/console sulu:security:role:create
  6. Uncomment the routes login and logout in your config/routes_website.yaml
  7. Uncomment your website firewall in your security.yaml
  8. Create your own login page https://github.com/sulu/sulu/blob/2.x/templates/static/login.html.twig
  9. Go to your /login page and connect as a user (that you created on point 13)

You should be redirected to the frontpage where the smart content is, and have the following error: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[term] query does not support [type]","line":1,"col":183}],"type":"x_content_parse_exception","reason":"[1:183] [bool] failed to parse field [must]","caused_by":{"type":"x_content_parse_exception","reason":"[1:183] [bool] failed to parse field [should]","caused_by":{"type":"parsing_exception","reason":"[term] query does not support [type]","line":1,"col":183}}},"status":400}

The error appears if:

  • You try to use smart content with a user connected via Sulu Community Bundle
  • If you connect as a sulu User where a smart content is active

UPDATE 2 OF MAY 2023

The bug has been fixed as of suluArticleBundle:2.4.1 sulu/SuluArticleBundle#626

About

Trying to reproduce the bug where a logged in sulu user can't see articles rendered by smart_content content type or alikes.


Languages

Language:PHP 71.7%Language:Twig 17.5%Language:JavaScript 10.8%