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

Introducing a dedicated permission per each search API index so query… #33

Open
wants to merge 1 commit into
base: 8.x-1.x
Choose a base branch
from

Conversation

bucefal91
Copy link

We have been using this module pretty successfully. In fact, it helps us expose 3 search API indexes over GraphQL api for our front end JS code.

However, only 2 of those 3 indexes are supposed to be public and the third may not be freely given access to. So we need some kind of per-index/per-role granularity there. This PR seeks to achieve this goal.

First of all, it introduces a dedicated permission per each Search API index that implies granting access to query it over graphql api. And then it adjusts the logic in the SearchApiSearch PHP class so it actively queries index for access before proceeding further. I made the access check to go via $index->access() so other modules, in case they have any opinion may provide their own access logic (in case just a plain permission per index is not enough).

:) I've tested it and works like a charm for us :) The only thing is that apparently breaks the backwards compatibility since now users need an explicit extra permission and before the access was simply implied there. But maybe introducing a global 'execute graphql requests on search api indexes' + an update hook that will grant this permission to all roles is enough to catch up on the backwards compatibility? :)

…ing certain indexes can be limited on per-role basis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant