Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being on a page as a connected sulu user, with smart content content type rendered, makes elasticsearch throwing an error #614

Open
tommysonsylverstone opened this issue Jun 22, 2022 · 0 comments
Labels
bug Error or unexpected behavior of already existing functionality

Comments

@tommysonsylverstone
Copy link

tommysonsylverstone commented Jun 22, 2022

Q A
Bug? yes
New Feature? no
SuluArticleBundle Version ^2.3
Sulu Version 2.4.3 (and 2.4.2 too)

Actual Behavior

How does Sulu behave at the moment?
When connected as a Sulu User (via sulu's basic login system or Sulu Community Bundle login), being on a page that is rendering a smart content or any other articles rendering content type makes symfony throw an error that is related to elasticsearch.

Expected Behavior

What is the behavior you expect?
Rendered articles/articles previews don't produce an error when connected as a Sulu User.

Steps to Reproduce

Here is the repository with all steps to reproduce the problem

Other things

  • I couldn't test if a simple symfony user works with the article bundle, as it is kind of hard to make a user with sulu's basic security.yaml configuration.
  • This problem is probably not related to massivesearch as searching for anything (including articles) from sulu's initial search form works fine.
  • ONLY the rendering of articles via a content type make everything explodes, but viewing an article page works fine.

EDIT August 4 2022

Elasticsearch queries in both cases:

Not connected (2 queries)
{
    "query": {
        "bool": {
            "must_not": [
                {
                    "term": {
                        "uuid": "9d548a2b-54f0-42b7-b741-ea48c674add9"
                    }
                }
            ],
            "must": [
                {
                    "term": {
                        "locale": "fr"
                    }
                },
                {
                    "match_all": {}
                },
                {
                    "bool": {
                        "should": [
                            {
                                "term": {
                                    "main_webspace": "pqna"
                                }
                            },
                            {
                                "term": {
                                    "additional_webspaces": "pqna"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "from": 0,
    "size": 100
}
{
    "query": {
        "bool": {
            "must_not": [
                {
                    "term": {
                        "uuid": "9d548a2b-54f0-42b7-b741-ea48c674add9"
                    }
                }
            ],
            "must": [
                {
                    "term": {
                        "locale": "fr"
                    }
                },
                {
                    "bool": {
                        "should": [
                            {
                                "term": {
                                    "structure_type": "pqna"
                                }
                            },
                            {
                                "term": {
                                    "structure_type": "actualites"
                                }
                            }
                        ]
                    }
                },
                {
                    "match_all": {}
                },
                {
                    "bool": {
                        "should": [
                            {
                                "term": {
                                    "main_webspace": "pqna"
                                }
                            },
                            {
                                "term": {
                                    "additional_webspaces": "pqna"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "sort": [
        {
            "published": {
                "order": "asc"
            }
        }
    ],
    "from": 0,
    "size": 3
}
Connected (1 query only)
{
    "query": {
        "bool": {
            "must_not": [
                {
                    "term": {
                        "uuid": "9d548a2b-54f0-42b7-b741-ea48c674add9"
                    }
                }
            ],
            "must": [
                {
                    "term": {
                        "locale": "fr"
                    }
                },
                {
                    "bool": {
                        "should": [
                            {
                                "term": {
                                    "type": {
                                        "value": "guide_methodologique",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "actualites",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "dispositifs_financiers",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "demarches_inspirantes",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "kits_fondamentaux",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "boite_a_outil_thematique",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "decryptage",
                                        "type": null
                                    }
                                }
                            },
                            {
                                "term": {
                                    "type": {
                                        "value": "default",
                                        "type": null
                                    }
                                }
                            }
                        ]
                    }
                },
                {
                    "match_all": {}
                },
                {
                    "bool": {
                        "should": [
                            {
                                "term": {
                                    "main_webspace": "pqna"
                                }
                            },
                            {
                                "term": {
                                    "additional_webspaces": "pqna"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "from": 0,
    "size": 100
}

The roles returned in my case are:

"ROLE_USER"
"ROLE_SULU_PQNAUSER"
"ROLE_SULU_USER"

The roles returned via the dump() twig function is PqnaUser which is on the Website system. (PqnaUser is the name of the user role I registered when doing the php bin/console sulu:community:init command line.)

The table se_roles is as follows:
se_roles

And here's my webspace.xml

webspace.xml
<?xml version="1.0" encoding="utf-8"?>
<webspace xmlns="http://schemas.sulu.io/webspace/webspace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.sulu.io/webspace/webspace http://schemas.sulu.io/webspace/webspace-1.1.xsd">
    <!-- See: http://docs.sulu.io/en/latest/book/webspaces.html how to configure your webspace-->

    <name>pqn-a.fr</name>
    <key>pqna</key>

    <security>
        <system>Website</system>
    </security>

    <localizations>
        <!-- See: http://docs.sulu.io/en/latest/book/localization.html how to add new localizations -->
        <localization language="en" />
        <localization language="fr" default="true"/>
    </localizations>

    <default-templates>
        <default-template type="page">pqna</default-template>
        <default-template type="home">pqna</default-template>
    </default-templates>

    <templates>
        <template type="search">search/search</template>
        <!-- See: http://docs.sulu.io/en/latest/cookbook/custom-error-page.html how to create a custom error page -->
        <template type="error">error/error</template>
    </templates>

    <navigation>
        <contexts>
            <context key="main">
                <meta>
                    <title lang="en">Main Navigation</title>
                    <title lang="fr">Navigation principale</title>
                </meta>
            </context>
        </contexts>
    </navigation>

    <portals>
        <portal>
            <name>pqn-a.fr</name>
            <key>pqna</key>

            <environments>
                <environment type="prod">
                    <urls>
                        <url language="en">{host}/{localization}</url>
                        <url language="fr">{host}/{localization}</url>
                    </urls>
                </environment>
                <environment type="stage">
                    <urls>
                        <url language="en">{host}/{localization}</url>
                        <url language="fr">{host}/{localization}</url>
                    </urls>
                </environment>
                <environment type="test">
                    <urls>
                        <url language="en">{host}/{localization}</url>
                        <url language="fr">{host}/{localization}</url>
                    </urls>
                </environment>
                <environment type="dev">
                    <urls>
                        <url language="en">{host}/{localization}</url>
                        <url language="fr">{host}/{localization}</url>
                    </urls>
                </environment>
            </environments>
        </portal>
    </portals>
</webspace>

@alexander-schranz alexander-schranz added the bug Error or unexpected behavior of already existing functionality label Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Error or unexpected behavior of already existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants